Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Uses one method from RTC to stop media streams.
damencho11e1197901c8
diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.jsindex 3edf995062..b788fb0c9c 100644--- a/modules/RTC/RTC.js+++ b/modules/RTC/RTC.js@@ -210,8 +210,8 @@ var RTC = {var videoStream = this.rtcUtils.createStream(stream, true);this.localVideo =this.createLocalStream(videoStream, "video", true, type);- // Stop the stream to trigger onended event for old stream- oldStream.stop();+ // Stop the stream+ this.stopMediaStream(oldStream);APP.xmpp.switchStreams(videoStream, oldStream,localCallback);},@@ -219,8 +219,8 @@ var RTC = {var oldStream = this.localAudio.getOriginalStream();var newStream = this.rtcUtils.createStream(stream);this.localAudio = this.createLocalStream(newStream, "audio", true);- // Stop the stream to trigger onended event for old stream- oldStream.stop();+ // Stop the stream+ this.stopMediaStream(oldStream);APP.xmpp.switchStreams(newStream, oldStream, callback, true);},isVideoMuted: function (jid) {@@ -262,6 +262,29 @@ var RTC = {if(devices.video === true || devices.video === false)this.devices.video = devices.video;eventEmitter.emit(RTCEvents.AVAILABLE_DEVICES_CHANGED, this.devices);+ },+ /**+ * A method to handle stopping of the stream.+ * One point to handle the differences in various implementations.+ */+ stopMediaStream: function (mediaStream) {+ mediaStream.getAudioTracks().forEach(function (track) {+ // stop() not supported with IE+ if (track.stop) {+ track.stop();+ }+ });+ mediaStream.getVideoTracks().forEach(function (track) {+ // stop() not supported with IE+ if (track.stop) {+ track.stop();+ }+ });++ //+ if (mediaStream.stop) {+ mediaStream.stop();+ }}};diff --git a/modules/xmpp/TraceablePeerConnection.js b/modules/xmpp/TraceablePeerConnection.jsindex f72055ad05..f1486bc66c 100644--- a/modules/xmpp/TraceablePeerConnection.js+++ b/modules/xmpp/TraceablePeerConnection.js@@ -258,21 +258,7 @@ TraceablePeerConnection.prototype.addStream = function (stream) {TraceablePeerConnection.prototype.removeStream = function (stream, stopStreams) {this.trace('removeStream', stream.id);if(stopStreams) {- stream.getAudioTracks().forEach(function (track) {- // stop() not supported with IE- if (track.stop) {- track.stop();- }- });- stream.getVideoTracks().forEach(function (track) {- // stop() not supported with IE- if (track.stop) {- track.stop();- }- });- if (stream.stop) {- stream.stop();- }+ RTC.stopMediaStream(stream);}try {