Fixes Uncaught TypeError: mediaStream.detachEvent on stopping desktop sharing.
This commit is contained in:
parent
09a509400f
commit
5f6bba435c
|
@ -300,18 +300,18 @@ var RTC = {
|
|||
* @param handler the handler
|
||||
*/
|
||||
addMediaStreamInactiveHandler: function (mediaStream, handler) {
|
||||
if (mediaStream.addEventListener) {
|
||||
// chrome
|
||||
if(typeof mediaStream.active !== "undefined")
|
||||
mediaStream.oninactive = handler;
|
||||
else
|
||||
mediaStream.onended = handler;
|
||||
} else {
|
||||
if(RTCBrowserType.isTemasysPluginUsed()) {
|
||||
// themasys
|
||||
mediaStream.attachEvent('ended', function () {
|
||||
handler(mediaStream);
|
||||
});
|
||||
}
|
||||
else {
|
||||
if(typeof mediaStream.active !== "undefined")
|
||||
mediaStream.oninactive = handler;
|
||||
else
|
||||
mediaStream.onended = handler;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Removes onended/inactive handler.
|
||||
|
@ -319,15 +319,15 @@ var RTC = {
|
|||
* @param handler the handler to remove.
|
||||
*/
|
||||
removeMediaStreamInactiveHandler: function (mediaStream, handler) {
|
||||
if (mediaStream.removeEventListener) {
|
||||
// chrome
|
||||
if(RTCBrowserType.isTemasysPluginUsed()) {
|
||||
// themasys
|
||||
mediaStream.detachEvent('ended', handler);
|
||||
}
|
||||
else {
|
||||
if(typeof mediaStream.active !== "undefined")
|
||||
mediaStream.oninactive = null;
|
||||
else
|
||||
mediaStream.onended = null;
|
||||
} else {
|
||||
// themasys
|
||||
mediaStream.detachEvent('ended', handler);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue