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 ({ " name" : " 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 114114 DataTrackSubscription ,
115115 DataTrackFrame ,
116116 DataTrackInfo ,
117- DataTrackOptions ,
118117 PushFrameError ,
119118 SubscribeDataTrackError ,
120119)
201200 "DataTrackSubscription" ,
202201 "DataTrackFrame" ,
203202 "DataTrackInfo" ,
204- "DataTrackOptions" ,
205203 "PushFrameError" ,
206204 "SubscribeDataTrackError" ,
207205 "__version__" ,
Original file line number Diff line number Diff line change 1616
1717import time
1818from dataclasses import dataclass
19- from typing import AsyncIterator , Optional , TypedDict
19+ from typing import AsyncIterator , Optional
2020
2121from ._ffi_client import FfiClient , FfiHandle
2222from ._proto import ffi_pb2 as proto_ffi
@@ -62,16 +62,6 @@ class DataTrackInfo:
6262 """Whether or not frames sent on the track use end-to-end encryption."""
6363
6464
65- class DataTrackOptions (TypedDict ):
66- """Options for publishing a data track."""
67-
68- name : str
69- """The track name is used to identify the track to other participants.
70-
71- Must not be empty and must be unique per publisher.
72- """
73-
74-
7565@dataclass
7666class DataTrackFrame :
7767 """A frame published on a data track, consisting of a payload and optional metadata."""
Original file line number Diff line number Diff line change 5353 ByteStreamInfo ,
5454 STREAM_CHUNK_SIZE ,
5555)
56- from .data_track import LocalDataTrack , DataTrackOptions
56+ from .data_track import LocalDataTrack
5757from ._proto import data_track_pb2 as proto_data_track
5858
5959
@@ -676,12 +676,14 @@ async def send_file(
676676
677677 async def publish_data_track (
678678 self ,
679- options : DataTrackOptions ,
679+ * ,
680+ name : str ,
680681 ) -> LocalDataTrack :
681682 """Publishes a data track.
682683
683684 Args:
684- options: Options for publishing the data track.
685+ name: The track name used to identify the track to other participants.
686+ Must not be empty and must be unique per publisher.
685687
686688 Returns:
687689 The published data track. Use :meth:`LocalDataTrack.try_push` to
@@ -690,7 +692,7 @@ async def publish_data_track(
690692 Raises:
691693 PublishDataTrackError: If there is an error publishing the data track.
692694 """
693- proto_opts = proto_data_track .DataTrackOptions (name = options [ " name" ] )
695+ proto_opts = proto_data_track .DataTrackOptions (name = name )
694696
695697 req = proto_ffi .FfiRequest ()
696698 req .publish_data_track .local_participant_handle = self ._ffi_handle .handle
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 ({ " name" : 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