Module livekit.rtc.track_publication

Classes

class LocalTrackPublication (owned_info: track_pb2.OwnedTrackPublication)
Expand source code
class LocalTrackPublication(TrackPublication):
    def __init__(self, owned_info: proto_track.OwnedTrackPublication):
        super().__init__(owned_info)
        self._first_subscription: asyncio.Future[None] = asyncio.Future()

    async def wait_for_subscription(self) -> None:
        await asyncio.shield(self._first_subscription)

    def __repr__(self) -> str:
        return f"rtc.LocalTrackPublication(sid={self.sid}, name={self.name}, kind={self.kind}, source={self.source})"

Ancestors

Methods

async def wait_for_subscription(self) ‑> None
class RemoteTrackPublication (owned_info: track_pb2.OwnedTrackPublication)
Expand source code
class RemoteTrackPublication(TrackPublication):
    def __init__(self, owned_info: proto_track.OwnedTrackPublication):
        super().__init__(owned_info)
        self.subscribed = False

    def set_subscribed(self, subscribed: bool):
        req = proto_ffi.FfiRequest()
        req.set_subscribed.subscribe = subscribed
        req.set_subscribed.publication_handle = self._ffi_handle.handle
        FfiClient.instance.request(req)

    def __repr__(self) -> str:
        return f"rtc.RemoteTrackPublication(sid={self.sid}, name={self.name}, kind={self.kind}, source={self.source})"

Ancestors

Methods

def set_subscribed(self, subscribed: bool)
class TrackPublication (owned_info: track_pb2.OwnedTrackPublication)
Expand source code
class TrackPublication:
    def __init__(self, owned_info: proto_track.OwnedTrackPublication):
        self._info = owned_info.info
        self.track: Optional[Track] = None
        self._ffi_handle = FfiHandle(owned_info.handle.id)

    @property
    def sid(self) -> str:
        return self._info.sid

    @property
    def name(self) -> str:
        return self._info.name

    @property
    def kind(self) -> proto_track.TrackKind.ValueType:
        return self._info.kind

    @property
    def source(self) -> proto_track.TrackSource.ValueType:
        return self._info.source

    @property
    def simulcasted(self) -> bool:
        return self._info.simulcasted

    @property
    def width(self) -> int:
        return self._info.width

    @property
    def height(self) -> int:
        return self._info.height

    @property
    def mime_type(self) -> str:
        return self._info.mime_type

    @property
    def muted(self) -> bool:
        return self._info.muted

    @property
    def encryption_type(self) -> proto_e2ee.EncryptionType.ValueType:
        return self._info.encryption_type

Subclasses

Instance variables

prop encryption_type : int
Expand source code
@property
def encryption_type(self) -> proto_e2ee.EncryptionType.ValueType:
    return self._info.encryption_type
prop height : int
Expand source code
@property
def height(self) -> int:
    return self._info.height
prop kind : int
Expand source code
@property
def kind(self) -> proto_track.TrackKind.ValueType:
    return self._info.kind
prop mime_type : str
Expand source code
@property
def mime_type(self) -> str:
    return self._info.mime_type
prop muted : bool
Expand source code
@property
def muted(self) -> bool:
    return self._info.muted
prop name : str
Expand source code
@property
def name(self) -> str:
    return self._info.name
prop sid : str
Expand source code
@property
def sid(self) -> str:
    return self._info.sid
prop simulcasted : bool
Expand source code
@property
def simulcasted(self) -> bool:
    return self._info.simulcasted
prop source : int
Expand source code
@property
def source(self) -> proto_track.TrackSource.ValueType:
    return self._info.source
prop width : int
Expand source code
@property
def width(self) -> int:
    return self._info.width