Fixes issue with toggling video mute in FF caused by the fact that it has no 'onended' callback handling implemented.

This commit is contained in:
paweldomas 2015-08-06 11:53:10 +02:00
parent e5d03d1d11
commit c288aa6e84
1 changed files with 22 additions and 1 deletions

View File

@ -1,6 +1,24 @@
/* global APP */
var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
var RTCEvents = require("../../service/RTC/RTCEvents");
var RTCBrowserType = require("./RTCBrowserType");
/**
* This implements 'onended' callback normally fired by WebRTC after the stream
* is stopped. There is no such behaviour yet in FF, so we have to add it.
* @param stream original WebRTC stream object to which 'onended' handling
* will be added.
*/
function implementOnEndedHandling(stream) {
var originalStop = stream.stop;
stream.stop = function () {
originalStop.apply(stream);
if (!stream.ended) {
stream.ended = true;
stream.onended();
}
};
}
function LocalStream(stream, type, eventEmitter, videoType, isGUMStream) {
this.stream = stream;
@ -24,6 +42,9 @@ function LocalStream(stream, type, eventEmitter, videoType, isGUMStream) {
this.stream.onended = function () {
self.streamEnded();
};
if (RTCBrowserType.isFirefox()) {
implementOnEndedHandling(this.stream);
}
}
LocalStream.prototype.streamEnded = function () {