Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom committed Oct 29, 2023
1 parent 531052d commit d55ed7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions examples/basic_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


async def main(room: rtc.Room) -> None:

@room.on("participant_connected")
def on_participant_connected(participant: rtc.RemoteParticipant) -> None:
logging.info(
Expand Down Expand Up @@ -105,7 +106,8 @@ def on_connection_quality_changed(
def on_track_subscription_failed(
participant: rtc.RemoteParticipant, track_sid: str, error: str
):
logging.info("track subscription failed: %s %s", participant.identity, error)
logging.info("track subscription failed: %s %s",
participant.identity, error)

@room.on("connection_state_changed")
def on_connection_state_changed(state: rtc.ConnectionState):
Expand Down Expand Up @@ -138,7 +140,8 @@ def on_reconnected() -> None:
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO,
handlers=[logging.FileHandler("basic_room.log"), logging.StreamHandler()],
handlers=[logging.FileHandler(
"basic_room.log"), logging.StreamHandler()],
)

loop = asyncio.get_event_loop()
Expand All @@ -150,7 +153,8 @@ async def cleanup():

asyncio.ensure_future(main(room))
for signal in [SIGINT, SIGTERM]:
loop.add_signal_handler(signal, lambda: asyncio.ensure_future(cleanup()))
loop.add_signal_handler(
signal, lambda: asyncio.ensure_future(cleanup()))

try:
loop.run_forever()
Expand Down
8 changes: 4 additions & 4 deletions examples/e2ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE5MDY2MTMyODgsImlzcyI6IkFQSVRzRWZpZFpqclFvWSIsIm5hbWUiOiJuYXRpdmUiLCJuYmYiOjE2NzI2MTMyODgsInN1YiI6Im5hdGl2ZSIsInZpZGVvIjp7InJvb20iOiJ0ZXN0Iiwicm9vbUFkbWluIjp0cnVlLCJyb29tQ3JlYXRlIjp0cnVlLCJyb29tSm9pbiI6dHJ1ZSwicm9vbUxpc3QiOnRydWV9fQ.uSNIangMRu8jZD5mnRYoCHjcsQWCrJXgHCs0aNIgBFY" # noqa

# ("livekitrocks") this is our shared key, it must match the one used by your clients
SHARED_KEY = b"liveitrocks"
SHARED_KEY = b"livekitrocks"


async def draw_cube(source: rtc.VideoSource):
Expand Down Expand Up @@ -45,8 +45,8 @@ async def draw_cube(source: rtc.VideoSource):
[3, 7],
]

frame = rtc.ArgbFrame(rtc.VideoFormatType.FORMAT_ARGB, W, H)
arr = np.ctypeslib.as_array(frame.data)
frame = rtc.ArgbFrame.create(rtc.VideoFormatType.FORMAT_ARGB, W, H)
arr = np.frombuffer(frame.data, dtype=np.uint8)
angle = 0

while True:
Expand Down Expand Up @@ -95,7 +95,7 @@ async def draw_cube(source: rtc.VideoSource):


async def main(room: rtc.Room):
@room.listens_to("e2ee_state_changed")
@room.on("e2ee_state_changed")
def on_e2ee_state_changed(
participant: rtc.Participant, state: rtc.EncryptionState
) -> None:
Expand Down

0 comments on commit d55ed7a

Please sign in to comment.