1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from typing import Optional
15+ from typing import Optional , cast
1616import asyncio
1717
1818from ._ffi_client import FfiHandle , FfiClient
1919from ._proto import e2ee_pb2 as proto_e2ee
2020from ._proto import ffi_pb2 as proto_ffi
2121from ._proto import track_pb2 as proto_track
22- from .track import Track
22+ from .track import Track , LocalTrack , RemoteTrack
2323
2424
2525class TrackPublication :
2626 def __init__ (self , owned_info : proto_track .OwnedTrackPublication ):
2727 self ._info = owned_info .info
28- self .track : Optional [Track ] = None
28+ self ._track : Optional [Track ] = None
2929 self ._ffi_handle = FfiHandle (owned_info .handle .id )
3030
31+ @property
32+ def track (self ) -> Optional [Track ]:
33+ return self ._track
34+
3135 @property
3236 def sid (self ) -> str :
3337 return self ._info .sid
@@ -74,6 +78,10 @@ def __init__(self, owned_info: proto_track.OwnedTrackPublication):
7478 super ().__init__ (owned_info )
7579 self ._first_subscription : asyncio .Future [None ] = asyncio .Future ()
7680
81+ @property
82+ def track (self ) -> Optional [LocalTrack ]:
83+ return cast (Optional [LocalTrack ], self ._track )
84+
7785 async def wait_for_subscription (self ) -> None :
7886 await asyncio .shield (self ._first_subscription )
7987
@@ -84,7 +92,15 @@ def __repr__(self) -> str:
8492class RemoteTrackPublication (TrackPublication ):
8593 def __init__ (self , owned_info : proto_track .OwnedTrackPublication ):
8694 super ().__init__ (owned_info )
87- self .subscribed = False
95+ self ._subscribed = False
96+
97+ @property
98+ def track (self ) -> Optional [RemoteTrack ]:
99+ return cast (Optional [RemoteTrack ], self ._track )
100+
101+ @property
102+ def subscribed (self ) -> bool :
103+ return self ._subscribed
88104
89105 def set_subscribed (self , subscribed : bool ):
90106 req = proto_ffi .FfiRequest ()
0 commit comments