Sfoglia il codice sorgente

New adapter.js for Temasys plugin.

master
paweldomas 10 anni fa
parent
commit
922d0bd512
1 ha cambiato i file con 33 aggiunte e 10 eliminazioni
  1. 33
    10
      modules/RTC/adapter.screenshare.js

+ 33
- 10
modules/RTC/adapter.screenshare.js Vedi File

1
-/*! adapterjs - custom version from - 2015-08-18 */
1
+/*! adapterjs - custom version from - 2015-08-19 */
2
 
2
 
3
 // Adapter's interface.
3
 // Adapter's interface.
4
 var AdapterJS = AdapterJS || {};
4
 var AdapterJS = AdapterJS || {};
354
         AdapterJS.WebRTCPlugin.isPluginInstalled(
354
         AdapterJS.WebRTCPlugin.isPluginInstalled(
355
           AdapterJS.WebRTCPlugin.pluginInfo.prefix,
355
           AdapterJS.WebRTCPlugin.pluginInfo.prefix,
356
           AdapterJS.WebRTCPlugin.pluginInfo.plugName,
356
           AdapterJS.WebRTCPlugin.pluginInfo.plugName,
357
-          AdapterJS.WebRTCPlugin.defineWebRTCInterface,
358
-          function() {
357
+          function() { // plugin now installed
359
             clearInterval(pluginInstallInterval);
358
             clearInterval(pluginInstallInterval);
360
             AdapterJS.WebRTCPlugin.defineWebRTCInterface();
359
             AdapterJS.WebRTCPlugin.defineWebRTCInterface();
361
           },
360
           },
362
-          function() {
363
-            //Does nothing because not used here
361
+          function() { 
362
+            // still no plugin detected, nothing to do
364
           });
363
           });
365
       } , 500);
364
       } , 500);
366
     });   
365
     });   
733
     return to;
732
     return to;
734
   };
733
   };
735
 
734
 
735
+  AdapterJS.maybeThroughWebRTCReady();
736
+} else if (navigator.mediaDevices && navigator.userAgent.match(
737
+    /Edge\/(\d+).(\d+)$/)) {
738
+  webrtcDetectedBrowser = 'edge';
739
+
740
+  webrtcDetectedVersion =
741
+    parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);
742
+
743
+  // the minimum version still supported by adapter.
744
+  webrtcMinimumVersion = 12;
745
+
746
+  getUserMedia = navigator.getUserMedia;
747
+
748
+  attachMediaStream = function(element, stream) {
749
+    element.srcObject = stream;
750
+    return element;
751
+  };
752
+  reattachMediaStream = function(to, from) {
753
+    to.srcObject = from.srcObject;
754
+    return to;
755
+  };
756
+
736
   AdapterJS.maybeThroughWebRTCReady();
757
   AdapterJS.maybeThroughWebRTCReady();
737
 } else { // TRY TO USE PLUGIN
758
 } else { // TRY TO USE PLUGIN
738
   // IE 9 is not offering an implementation of console.log until you open a console
759
   // IE 9 is not offering an implementation of console.log until you open a console
885
   AdapterJS.WebRTCPlugin.defineWebRTCInterface = function () {
906
   AdapterJS.WebRTCPlugin.defineWebRTCInterface = function () {
886
     if (AdapterJS.WebRTCPlugin.pluginState ===
907
     if (AdapterJS.WebRTCPlugin.pluginState ===
887
         AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
908
         AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
888
-      console.error("WebRTC interface has been defined already");
909
+      console.error("AdapterJS - WebRTC interface has already been defined");
889
       return;
910
       return;
890
     }
911
     }
912
+
891
     AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING;
913
     AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING;
892
 
914
 
893
     AdapterJS.isDefined = function (variable) {
915
     AdapterJS.isDefined = function (variable) {
984
       }
1006
       }
985
 
1007
 
986
       var elementId = element.id.length === 0 ? Math.random().toString(36).slice(2) : element.id;
1008
       var elementId = element.id.length === 0 ? Math.random().toString(36).slice(2) : element.id;
987
-      if (!element.isWebRTCPlugin || !element.isWebRTCPlugin()) {
1009
+      var nodeName = element.nodeName.toLowerCase();
1010
+      if (nodeName !== 'object') { // not a plugin <object> tag yet
988
         var tag;
1011
         var tag;
989
-        switch(element.nodeName.toLowerCase()) {
1012
+        switch(nodeName) {
990
           case 'audio':
1013
           case 'audio':
991
             tag = AdapterJS.WebRTCPlugin.TAGS.AUDIO;
1014
             tag = AdapterJS.WebRTCPlugin.TAGS.AUDIO;
992
             break;
1015
             break;
1037
         frag.width = width;
1060
         frag.width = width;
1038
         frag.height = height;
1061
         frag.height = height;
1039
         element.parentNode.removeChild(element);
1062
         element.parentNode.removeChild(element);
1040
-      } else {
1063
+      } else { // already an <object> tag, just change the stream id
1041
         var children = element.children;
1064
         var children = element.children;
1042
         for (var i = 0; i !== children.length; ++i) {
1065
         for (var i = 0; i !== children.length; ++i) {
1043
           if (children[i].name === 'streamId') {
1066
           if (children[i].name === 'streamId') {
1049
       }
1072
       }
1050
       var newElement = document.getElementById(elementId);
1073
       var newElement = document.getElementById(elementId);
1051
       newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
1074
       newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
1075
+      newElement.onclick   = (element.onclick)   ? element.onclick   : function (arg) {};
1052
       if (isIE) { // on IE the event needs to be plugged manually
1076
       if (isIE) { // on IE the event needs to be plugged manually
1053
         newElement.attachEvent('onplaying', newElement.onplaying);
1077
         newElement.attachEvent('onplaying', newElement.onplaying);
1054
-        newElement.onclick = (element.onclick) ? element.onclick : function (arg) {};
1055
         newElement._TemOnClick = function (id) {
1078
         newElement._TemOnClick = function (id) {
1056
           var arg = {
1079
           var arg = {
1057
             srcElement : document.getElementById(id)
1080
             srcElement : document.getElementById(id)

Loading…
Annulla
Salva