Option to unpublish without stopping track (#45)

* implement

* rename

* only for local

* keep option

* no per unpublish option to stop track

* format

* format
This commit is contained in:
Hiroshi Horie
2021-12-03 11:06:21 +07:00
committed by GitHub
parent 679d0b81d3
commit 77dc98601a
2 changed files with 8 additions and 1 deletions
+5
View File
@@ -20,11 +20,16 @@ class ConnectOptions {
/// defaults to true.
final bool optimizeVideo;
/// Set this to false in case you would like to stop the track yourself.
/// defaults to true.
final bool stopLocalTrackOnUnpublish;
const ConnectOptions({
this.autoSubscribe = true,
this.defaultVideoPublishOptions = const VideoPublishOptions(),
this.defaultAudioPublishOptions = const AudioPublishOptions(),
this.optimizeVideo = true,
this.stopLocalTrackOnUnpublish = true,
});
}
+3 -1
View File
@@ -188,7 +188,9 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
final track = pub.track;
if (track != null) {
await track.stop();
if (engine.connectOptions.stopLocalTrackOnUnpublish) {
await track.stop();
}
final sender = track.transceiver?.sender;
if (sender != null) {