feat: Support setVideoFPS for subscribe. (#258)
* feat: Support setVideoFPS for subscribe. * Update lib/src/publication/remote.dart Co-authored-by: David Zhao <dz@livekit.io> * Add comment for setVideoFPS. --------- Co-authored-by: David Zhao <dz@livekit.io>
This commit is contained in:
@@ -31,6 +31,10 @@ class RemoteTrackPublication<T extends RemoteTrack>
|
||||
bool get enabled => _enabled;
|
||||
bool _enabled = true;
|
||||
|
||||
/// The current desired FPS of the track. This is only available for video tracks that support SVC.
|
||||
int? _fps;
|
||||
int get fps => _fps ?? 0;
|
||||
|
||||
lk_models.VideoQuality _videoQuality = lk_models.VideoQuality.HIGH;
|
||||
lk_models.VideoQuality get videoQuality => _videoQuality;
|
||||
|
||||
@@ -227,6 +231,14 @@ class RemoteTrackPublication<T extends RemoteTrack>
|
||||
sendUpdateTrackSettings();
|
||||
}
|
||||
|
||||
/// Set desired FPS, server will do its best to return FPS close to this.
|
||||
/// It's only supported for video codecs that support SVC currently.
|
||||
Future<void> setVideoFPS(int newValue) async {
|
||||
if (newValue == _fps) return;
|
||||
_fps = newValue;
|
||||
sendUpdateTrackSettings();
|
||||
}
|
||||
|
||||
Future<void> enable() async {
|
||||
if (_enabled) return;
|
||||
_enabled = true;
|
||||
@@ -289,6 +301,7 @@ class RemoteTrackPublication<T extends RemoteTrack>
|
||||
);
|
||||
if (kind == lk_models.TrackType.VIDEO) {
|
||||
settings.quality = _videoQuality;
|
||||
if (_fps != null) settings.fps = _fps!;
|
||||
}
|
||||
participant.room.engine.signalClient.sendUpdateTrackSettings(settings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user