new fix for #107 ?

pull/127/head
Martin Schleyer 2018-10-06 13:34:27 +02:00
parent 6e7d345774
commit 75cb15ee12
1 changed files with 11 additions and 6 deletions

View File

@ -447,12 +447,17 @@ export class Stream implements EventDispatcher {
*/
disposeMediaStream(): void {
if (this.mediaStream) {
this.mediaStream.getAudioTracks().forEach((track) => {
track.stop();
});
this.mediaStream.getVideoTracks().forEach((track) => {
track.stop();
});
const isSenderAndCustomTrack: boolean = !!this.outboundStreamOpts &&
this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack;
if (!isSenderAndCustomTrack) {
this.mediaStream.getAudioTracks().forEach((track) => {
track.stop();
});
this.mediaStream.getVideoTracks().forEach((track) => {
track.stop();
});
}
delete this.mediaStream;
}
console.info((!!this.outboundStreamOpts ? 'Local ' : 'Remote ') + "MediaStream from 'Stream' with id [" + this.streamId + '] is now disposed');