ソースを参照

New adapter.js for Temasys plugin.

master
paweldomas 10年前
コミット
922d0bd512
1個のファイルの変更33行の追加10行の削除
  1. 33
    10
      modules/RTC/adapter.screenshare.js

+ 33
- 10
modules/RTC/adapter.screenshare.js ファイルの表示

@@ -1,4 +1,4 @@
1
-/*! adapterjs - custom version from - 2015-08-18 */
1
+/*! adapterjs - custom version from - 2015-08-19 */
2 2
 
3 3
 // Adapter's interface.
4 4
 var AdapterJS = AdapterJS || {};
@@ -354,13 +354,12 @@ AdapterJS.renderNotificationBar = function (text, buttonText, buttonLink, openNe
354 354
         AdapterJS.WebRTCPlugin.isPluginInstalled(
355 355
           AdapterJS.WebRTCPlugin.pluginInfo.prefix,
356 356
           AdapterJS.WebRTCPlugin.pluginInfo.plugName,
357
-          AdapterJS.WebRTCPlugin.defineWebRTCInterface,
358
-          function() {
357
+          function() { // plugin now installed
359 358
             clearInterval(pluginInstallInterval);
360 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 364
       } , 500);
366 365
     });   
@@ -733,6 +732,28 @@ if (navigator.mozGetUserMedia) {
733 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 757
   AdapterJS.maybeThroughWebRTCReady();
737 758
 } else { // TRY TO USE PLUGIN
738 759
   // IE 9 is not offering an implementation of console.log until you open a console
@@ -885,9 +906,10 @@ if (navigator.mozGetUserMedia) {
885 906
   AdapterJS.WebRTCPlugin.defineWebRTCInterface = function () {
886 907
     if (AdapterJS.WebRTCPlugin.pluginState ===
887 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 910
       return;
890 911
     }
912
+
891 913
     AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING;
892 914
 
893 915
     AdapterJS.isDefined = function (variable) {
@@ -984,9 +1006,10 @@ if (navigator.mozGetUserMedia) {
984 1006
       }
985 1007
 
986 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 1011
         var tag;
989
-        switch(element.nodeName.toLowerCase()) {
1012
+        switch(nodeName) {
990 1013
           case 'audio':
991 1014
             tag = AdapterJS.WebRTCPlugin.TAGS.AUDIO;
992 1015
             break;
@@ -1037,7 +1060,7 @@ if (navigator.mozGetUserMedia) {
1037 1060
         frag.width = width;
1038 1061
         frag.height = height;
1039 1062
         element.parentNode.removeChild(element);
1040
-      } else {
1063
+      } else { // already an <object> tag, just change the stream id
1041 1064
         var children = element.children;
1042 1065
         for (var i = 0; i !== children.length; ++i) {
1043 1066
           if (children[i].name === 'streamId') {
@@ -1049,9 +1072,9 @@ if (navigator.mozGetUserMedia) {
1049 1072
       }
1050 1073
       var newElement = document.getElementById(elementId);
1051 1074
       newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
1075
+      newElement.onclick   = (element.onclick)   ? element.onclick   : function (arg) {};
1052 1076
       if (isIE) { // on IE the event needs to be plugged manually
1053 1077
         newElement.attachEvent('onplaying', newElement.onplaying);
1054
-        newElement.onclick = (element.onclick) ? element.onclick : function (arg) {};
1055 1078
         newElement._TemOnClick = function (id) {
1056 1079
           var arg = {
1057 1080
             srcElement : document.getElementById(id)

読み込み中…
キャンセル
保存