Skip to content

Commit

Permalink
new fix for OpenVidu#107 ?
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Schleyer committed Oct 6, 2018
1 parent 6e7d345 commit 75cb15e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions openvidu-browser/src/OpenVidu/Stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 75cb15e

Please sign in to comment.