12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- from typing import Optional
15
+ from typing import Optional , cast
16
16
import asyncio
17
17
18
18
from ._ffi_client import FfiHandle , FfiClient
19
19
from ._proto import e2ee_pb2 as proto_e2ee
20
20
from ._proto import ffi_pb2 as proto_ffi
21
21
from ._proto import track_pb2 as proto_track
22
- from .track import Track
22
+ from .track import Track , LocalTrack , RemoteTrack
23
23
24
24
25
25
class TrackPublication :
26
26
def __init__ (self , owned_info : proto_track .OwnedTrackPublication ):
27
27
self ._info = owned_info .info
28
- self .track : Optional [Track ] = None
28
+ self ._track : Optional [Track ] = None
29
29
self ._ffi_handle = FfiHandle (owned_info .handle .id )
30
30
31
+ @property
32
+ def track (self ) -> Optional [Track ]:
33
+ return self ._track
34
+
31
35
@property
32
36
def sid (self ) -> str :
33
37
return self ._info .sid
@@ -74,6 +78,10 @@ def __init__(self, owned_info: proto_track.OwnedTrackPublication):
74
78
super ().__init__ (owned_info )
75
79
self ._first_subscription : asyncio .Future [None ] = asyncio .Future ()
76
80
81
+ @property
82
+ def track (self ) -> Optional [LocalTrack ]:
83
+ return cast (Optional [LocalTrack ], self ._track )
84
+
77
85
async def wait_for_subscription (self ) -> None :
78
86
await asyncio .shield (self ._first_subscription )
79
87
@@ -84,7 +92,15 @@ def __repr__(self) -> str:
84
92
class RemoteTrackPublication (TrackPublication ):
85
93
def __init__ (self , owned_info : proto_track .OwnedTrackPublication ):
86
94
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
88
104
89
105
def set_subscribed (self , subscribed : bool ):
90
106
req = proto_ffi .FfiRequest ()
0 commit comments