10
10
11
11
async def main ():
12
12
logging .basicConfig (level = logging .INFO )
13
+ logger = logging .getLogger (__name__ )
13
14
room = rtc .Room ()
14
15
15
16
@room .on ("participant_connected" )
16
17
def on_participant_connected (participant : rtc .RemoteParticipant ):
17
- logging .info (
18
+ logger .info (
18
19
"participant connected: %s %s" , participant .sid , participant .identity
19
20
)
20
21
@@ -30,15 +31,15 @@ def on_track_subscribed(
30
31
publication : rtc .RemoteTrackPublication ,
31
32
participant : rtc .RemoteParticipant ,
32
33
):
33
- logging .info ("track subscribed: %s" , publication .sid )
34
+ logger .info ("track subscribed: %s" , publication .sid )
34
35
if track .kind == rtc .TrackKind .KIND_VIDEO :
35
36
video_stream = rtc .VideoStream (track )
36
37
asyncio .ensure_future (receive_frames (video_stream ))
37
38
38
39
# By default, autosubscribe is enabled. The participant will be subscribed to
39
40
# all published tracks in the room
40
41
await room .connect (URL , TOKEN )
41
- logging .info ("connected to room %s" , room .name )
42
+ logger .info ("connected to room %s" , room .name )
42
43
43
44
for identity , participant in room .remote_participants .items ():
44
45
print (f"identity: { identity } " )
@@ -48,8 +49,10 @@ def on_track_subscribed(
48
49
print (f"participant identity: { participant .identity } " )
49
50
print (f"participant name: { participant .name } " )
50
51
print (f"participant kind: { participant .kind } " )
51
- print (f"participant track publications: {
52
- participant .track_publications } " )
52
+ print (
53
+ f"participant track publications: {
54
+ participant .track_publications } "
55
+ )
53
56
for tid , publication in participant .track_publications .items ():
54
57
print (f"\t track id: { tid } " )
55
58
print (f"\t \t track publication: { publication } " )
0 commit comments