Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ jobs:
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
run: |
source .test-venv/bin/activate
pytest tests/
pytest tests/ livekit-rtc/tests/

- name: Run tests (Windows)
if: runner.os == 'Windows'
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
run: .test-venv\Scripts\python.exe -m pytest tests/
run: .test-venv\Scripts\python.exe -m pytest tests/ livekit-rtc/tests/
shell: pwsh

2 changes: 2 additions & 0 deletions livekit-rtc/livekit/rtc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
TrackSource,
ParticipantTrackPermission,
)
from ._proto.track_publication_pb2 import VideoQuality
from ._proto.video_frame_pb2 import VideoBufferType, VideoCodec, VideoRotation
from .audio_frame import AudioFrame
from .audio_source import AudioSource
Expand Down Expand Up @@ -185,6 +186,7 @@
"TranscriptionSegment",
"VideoCodec",
"VideoEncoding",
"VideoQuality",
"VideoFrame",
"VideoFrameEvent",
"VideoSource",
Expand Down
15 changes: 15 additions & 0 deletions livekit-rtc/livekit/rtc/track_publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
from ._proto import e2ee_pb2 as proto_e2ee
from ._proto import ffi_pb2 as proto_ffi
from ._proto import track_pb2 as proto_track
from ._proto import track_publication_pb2 as proto_track_pub
from .track import Track, LocalTrack, RemoteTrack

VideoQuality = proto_track_pub.VideoQuality


class TrackPublication:
def __init__(self, owned_info: proto_track.OwnedTrackPublication):
Expand Down Expand Up @@ -112,5 +115,17 @@ def set_subscribed(self, subscribed: bool):
req.set_subscribed.publication_handle = self._ffi_handle.handle
FfiClient.instance.request(req)

def set_video_quality(self, quality: "VideoQuality.ValueType") -> None:
"""For simulcasted video tracks, request a specific simulcast layer
from the server. Use one of `rtc.VideoQuality.VIDEO_QUALITY_LOW` (q),
`VIDEO_QUALITY_MEDIUM` (h), or `VIDEO_QUALITY_HIGH` (f).

This is a no-op (the SDK logs a warning) if the publication is not
simulcasted."""
req = proto_ffi.FfiRequest()
req.set_remote_track_publication_quality.track_publication_handle = self._ffi_handle.handle
req.set_remote_track_publication_quality.quality = quality
FfiClient.instance.request(req)

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