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.
|
* @param mediaStream MediaStream object to stop.
|
||||||
*/
|
*/
|
||||||
stopMediaStream: function (mediaStream) {
|
stopMediaStream: function (mediaStream) {
|
||||||
mediaStream.getAudioTracks().forEach(function (track) {
|
mediaStream.getTracks().forEach(function (track) {
|
||||||
// stop() not supported with IE
|
|
||||||
if (track.stop) {
|
|
||||||
track.stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mediaStream.getVideoTracks().forEach(function (track) {
|
|
||||||
// stop() not supported with IE
|
// stop() not supported with IE
|
||||||
if (track.stop) {
|
if (track.stop) {
|
||||||
track.stop();
|
track.stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
// leave stop for implementation still using it
|
||||||
if (mediaStream.stop) {
|
if (mediaStream.stop) {
|
||||||
mediaStream.stop();
|
mediaStream.stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue