From 249e032ad6476510c1c2ce83f9202f28e83eb50f Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 2 Nov 2015 15:39:28 -0600 Subject: [PATCH] Uses stopping tracks and use MediaStream.stop method only if defined. Based on previous code and inspired by PR #390. --- modules/RTC/RTC.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index e8742cac0..eb1b4242b 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -269,20 +269,14 @@ var RTC = { * @param mediaStream MediaStream object to stop. */ stopMediaStream: function (mediaStream) { - mediaStream.getAudioTracks().forEach(function (track) { - // stop() not supported with IE - if (track.stop) { - track.stop(); - } - }); - mediaStream.getVideoTracks().forEach(function (track) { + mediaStream.getTracks().forEach(function (track) { // stop() not supported with IE if (track.stop) { track.stop(); } }); - // + // leave stop for implementation still using it if (mediaStream.stop) { mediaStream.stop(); }