update track settings (#77)
This commit is contained in:
@@ -116,6 +116,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
..on<EngineReconnectedEvent>((event) async {
|
||||
_connectionState = ConnectionState.connected;
|
||||
events.emit(const RoomReconnectedEvent());
|
||||
await _handlePostReconnect(false);
|
||||
})
|
||||
..on<EngineReconnectingEvent>((event) async {
|
||||
_connectionState = ConnectionState.reconnecting;
|
||||
@@ -472,6 +473,20 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _handlePostReconnect(bool isFullReconnect) async {
|
||||
if (isFullReconnect) {
|
||||
// TODO republish tracks on full reconnect
|
||||
} else {
|
||||
for (var participant in participants.values) {
|
||||
for (var pub in participant.trackPublications.values) {
|
||||
if (pub.subscribed) {
|
||||
pub.sendUpdateTrackSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// To be used for internal testing purposes only.
|
||||
Future<void> simulateScenario({
|
||||
int? speakerUpdate,
|
||||
|
||||
@@ -220,19 +220,19 @@ class RemoteTrackPublication<T extends RemoteTrack>
|
||||
set videoQuality(lk_models.VideoQuality newValue) {
|
||||
if (newValue == _videoQuality) return;
|
||||
_videoQuality = newValue;
|
||||
_sendUpdateTrackSettings();
|
||||
sendUpdateTrackSettings();
|
||||
}
|
||||
|
||||
Future<void> enable() async {
|
||||
if (_enabled) return;
|
||||
_enabled = true;
|
||||
_sendUpdateTrackSettings();
|
||||
sendUpdateTrackSettings();
|
||||
}
|
||||
|
||||
Future<void> disable() async {
|
||||
if (!_enabled) return;
|
||||
_enabled = false;
|
||||
_sendUpdateTrackSettings();
|
||||
sendUpdateTrackSettings();
|
||||
}
|
||||
|
||||
Future<void> subscribe() async {
|
||||
@@ -277,7 +277,8 @@ class RemoteTrackPublication<T extends RemoteTrack>
|
||||
participant.room.engine.signalClient.sendUpdateSubscription(subscription);
|
||||
}
|
||||
|
||||
void _sendUpdateTrackSettings() {
|
||||
@internal
|
||||
void sendUpdateTrackSettings() {
|
||||
final settings = lk_rtc.UpdateTrackSettings(
|
||||
trackSids: [sid],
|
||||
disabled: !_enabled,
|
||||
|
||||
Reference in New Issue
Block a user