File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ async def on_welcome_image_received(
4141 logger .info (
4242 "Received image from %s: '%s'" , participant_identity , reader .info ["name" ]
4343 )
44+ with open (reader .info ["name" ], mode = "wb" ) as f :
45+ async for chunk in reader :
46+ f .write (chunk )
47+
48+ f .close ()
4449
4550 @room .on ("participant_connected" )
4651 def on_participant_connected (participant : rtc .RemoteParticipant ):
@@ -76,7 +81,10 @@ def on_participant_connected(participant: rtc.RemoteParticipant):
7681if __name__ == "__main__" :
7782 logging .basicConfig (
7883 level = logging .INFO ,
79- handlers = [logging .FileHandler ("basic_room.log" ), logging .StreamHandler ()],
84+ handlers = [
85+ logging .FileHandler ("data_stream_example.log" ),
86+ logging .StreamHandler (),
87+ ],
8088 )
8189
8290 loop = asyncio .get_event_loop ()
Original file line number Diff line number Diff line change @@ -747,9 +747,9 @@ def _on_room_event(self, event: proto_room.RoomEvent):
747747 event .stream_header_received .participant_identity ,
748748 )
749749 elif which == "stream_chunk_received" :
750- asyncio .run (self ._handle_stream_chunk (event .stream_chunk_received .chunk ))
750+ asyncio .gather (self ._handle_stream_chunk (event .stream_chunk_received .chunk ))
751751 elif which == "stream_trailer_received" :
752- asyncio .run (
752+ asyncio .gather (
753753 self ._handle_stream_trailer (event .stream_trailer_received .trailer )
754754 )
755755
You can’t perform that action at this time.
0 commit comments