New adapter.js for Temasys plugin.
This commit is contained in:
parent
9a7bc4ebab
commit
922d0bd512
|
@ -1,4 +1,4 @@
|
||||||
/*! adapterjs - custom version from - 2015-08-18 */
|
/*! adapterjs - custom version from - 2015-08-19 */
|
||||||
|
|
||||||
// Adapter's interface.
|
// Adapter's interface.
|
||||||
var AdapterJS = AdapterJS || {};
|
var AdapterJS = AdapterJS || {};
|
||||||
|
@ -354,13 +354,12 @@ AdapterJS.renderNotificationBar = function (text, buttonText, buttonLink, openNe
|
||||||
AdapterJS.WebRTCPlugin.isPluginInstalled(
|
AdapterJS.WebRTCPlugin.isPluginInstalled(
|
||||||
AdapterJS.WebRTCPlugin.pluginInfo.prefix,
|
AdapterJS.WebRTCPlugin.pluginInfo.prefix,
|
||||||
AdapterJS.WebRTCPlugin.pluginInfo.plugName,
|
AdapterJS.WebRTCPlugin.pluginInfo.plugName,
|
||||||
AdapterJS.WebRTCPlugin.defineWebRTCInterface,
|
function() { // plugin now installed
|
||||||
function() {
|
|
||||||
clearInterval(pluginInstallInterval);
|
clearInterval(pluginInstallInterval);
|
||||||
AdapterJS.WebRTCPlugin.defineWebRTCInterface();
|
AdapterJS.WebRTCPlugin.defineWebRTCInterface();
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
//Does nothing because not used here
|
// still no plugin detected, nothing to do
|
||||||
});
|
});
|
||||||
} , 500);
|
} , 500);
|
||||||
});
|
});
|
||||||
|
@ -733,6 +732,28 @@ if (navigator.mozGetUserMedia) {
|
||||||
return to;
|
return to;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AdapterJS.maybeThroughWebRTCReady();
|
||||||
|
} else if (navigator.mediaDevices && navigator.userAgent.match(
|
||||||
|
/Edge\/(\d+).(\d+)$/)) {
|
||||||
|
webrtcDetectedBrowser = 'edge';
|
||||||
|
|
||||||
|
webrtcDetectedVersion =
|
||||||
|
parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);
|
||||||
|
|
||||||
|
// the minimum version still supported by adapter.
|
||||||
|
webrtcMinimumVersion = 12;
|
||||||
|
|
||||||
|
getUserMedia = navigator.getUserMedia;
|
||||||
|
|
||||||
|
attachMediaStream = function(element, stream) {
|
||||||
|
element.srcObject = stream;
|
||||||
|
return element;
|
||||||
|
};
|
||||||
|
reattachMediaStream = function(to, from) {
|
||||||
|
to.srcObject = from.srcObject;
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
|
||||||
AdapterJS.maybeThroughWebRTCReady();
|
AdapterJS.maybeThroughWebRTCReady();
|
||||||
} else { // TRY TO USE PLUGIN
|
} else { // TRY TO USE PLUGIN
|
||||||
// IE 9 is not offering an implementation of console.log until you open a console
|
// IE 9 is not offering an implementation of console.log until you open a console
|
||||||
|
@ -885,9 +906,10 @@ if (navigator.mozGetUserMedia) {
|
||||||
AdapterJS.WebRTCPlugin.defineWebRTCInterface = function () {
|
AdapterJS.WebRTCPlugin.defineWebRTCInterface = function () {
|
||||||
if (AdapterJS.WebRTCPlugin.pluginState ===
|
if (AdapterJS.WebRTCPlugin.pluginState ===
|
||||||
AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
|
AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
|
||||||
console.error("WebRTC interface has been defined already");
|
console.error("AdapterJS - WebRTC interface has already been defined");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING;
|
AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING;
|
||||||
|
|
||||||
AdapterJS.isDefined = function (variable) {
|
AdapterJS.isDefined = function (variable) {
|
||||||
|
@ -984,9 +1006,10 @@ if (navigator.mozGetUserMedia) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var elementId = element.id.length === 0 ? Math.random().toString(36).slice(2) : element.id;
|
var elementId = element.id.length === 0 ? Math.random().toString(36).slice(2) : element.id;
|
||||||
if (!element.isWebRTCPlugin || !element.isWebRTCPlugin()) {
|
var nodeName = element.nodeName.toLowerCase();
|
||||||
|
if (nodeName !== 'object') { // not a plugin <object> tag yet
|
||||||
var tag;
|
var tag;
|
||||||
switch(element.nodeName.toLowerCase()) {
|
switch(nodeName) {
|
||||||
case 'audio':
|
case 'audio':
|
||||||
tag = AdapterJS.WebRTCPlugin.TAGS.AUDIO;
|
tag = AdapterJS.WebRTCPlugin.TAGS.AUDIO;
|
||||||
break;
|
break;
|
||||||
|
@ -1037,7 +1060,7 @@ if (navigator.mozGetUserMedia) {
|
||||||
frag.width = width;
|
frag.width = width;
|
||||||
frag.height = height;
|
frag.height = height;
|
||||||
element.parentNode.removeChild(element);
|
element.parentNode.removeChild(element);
|
||||||
} else {
|
} else { // already an <object> tag, just change the stream id
|
||||||
var children = element.children;
|
var children = element.children;
|
||||||
for (var i = 0; i !== children.length; ++i) {
|
for (var i = 0; i !== children.length; ++i) {
|
||||||
if (children[i].name === 'streamId') {
|
if (children[i].name === 'streamId') {
|
||||||
|
@ -1049,9 +1072,9 @@ if (navigator.mozGetUserMedia) {
|
||||||
}
|
}
|
||||||
var newElement = document.getElementById(elementId);
|
var newElement = document.getElementById(elementId);
|
||||||
newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
|
newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
|
||||||
|
newElement.onclick = (element.onclick) ? element.onclick : function (arg) {};
|
||||||
if (isIE) { // on IE the event needs to be plugged manually
|
if (isIE) { // on IE the event needs to be plugged manually
|
||||||
newElement.attachEvent('onplaying', newElement.onplaying);
|
newElement.attachEvent('onplaying', newElement.onplaying);
|
||||||
newElement.onclick = (element.onclick) ? element.onclick : function (arg) {};
|
|
||||||
newElement._TemOnClick = function (id) {
|
newElement._TemOnClick = function (id) {
|
||||||
var arg = {
|
var arg = {
|
||||||
srcElement : document.getElementById(id)
|
srcElement : document.getElementById(id)
|
||||||
|
|
Loading…
Reference in New Issue