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:
parent
fa138eae43
commit
249e032ad6
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue