Match muted behavior with JS SDK (#32)

* attempt 1

* implement

* clean up

* clean up

* cleaner code

* mute was opposite

* fix suggestion

* fix local pub muted

* update example

* update pubs

* format
This commit is contained in:
Hiroshi Horie
2021-11-20 02:39:52 +07:00
committed by GitHub
parent 4a59a1e6d5
commit 4f0973ce66
15 changed files with 199 additions and 130 deletions
+4 -3
View File
@@ -247,15 +247,16 @@ extension LocalParticipantTrackSourceExt on LocalParticipant {
}
Future<void> setSourceEnabled(TrackSource source, bool enabled) async {
final pub = getTrackPublicationBySource(source);
logger.fine('setSourceEnabled(source: $source, enabled: $enabled)');
final pub = getTrackPublicationBySource(source) as LocalTrackPublication?;
if (pub != null) {
if (enabled) {
pub.muted = false;
await pub.unmute();
} else {
if (source == TrackSource.screenShareVideo) {
await unpublishTrack(pub.sid);
} else {
pub.muted = true;
await pub.mute();
}
}
} else if (enabled) {