Uses stopping tracks and use MediaStream.stop method only if defined. Based on previous code and inspired by PR #390.

This commit is contained in:
damencho 2015-11-02 15:39:28 -06:00
parent fa138eae43
commit 249e032ad6
1 changed files with 2 additions and 8 deletions

View File

@ -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();
}