File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ async def main(room: rtc.Room):
3333 await room .connect (URL , TOKEN )
3434 logger .info ("connected to room %s" , room .name )
3535
36- track = await room .local_participant .publish_data_track (" my_sensor_data" )
36+ track = await room .local_participant .publish_data_track ({ "name" : " my_sensor_data"} )
3737 await push_frames (track )
3838
3939
Original file line number Diff line number Diff line change @@ -676,13 +676,12 @@ async def send_file(
676676
677677 async def publish_data_track (
678678 self ,
679- options : Union [ str , DataTrackOptions ] ,
679+ options : DataTrackOptions ,
680680 ) -> LocalDataTrack :
681681 """Publishes a data track.
682682
683683 Args:
684- options: Either a track name string or a :class:`DataTrackOptions`
685- object. When a string is provided, it is used as the track name.
684+ options: Options for publishing the data track.
686685
687686 Returns:
688687 The published data track. Use :meth:`LocalDataTrack.try_push` to
@@ -691,9 +690,6 @@ async def publish_data_track(
691690 Raises:
692691 PublishDataTrackError: If there is an error publishing the data track.
693692 """
694- if isinstance (options , str ):
695- options = DataTrackOptions (name = options )
696-
697693 proto_opts = proto_data_track .DataTrackOptions (name = options ["name" ])
698694
699695 req = proto_ffi .FfiRequest ()
Original file line number Diff line number Diff line change @@ -477,7 +477,7 @@ def on_data_track_unpublished(sid: str):
477477 await subscriber_room .connect (url , subscriber_token )
478478 await publisher_room .connect (url , publisher_token )
479479
480- local_track = await publisher_room .local_participant .publish_data_track (TRACK_NAME )
480+ local_track = await publisher_room .local_participant .publish_data_track ({ "name" : TRACK_NAME } )
481481 assert local_track .info .sid is not None
482482 assert local_track .info .name == TRACK_NAME
483483 assert local_track .is_published ()
You can’t perform that action at this time.
0 commit comments