1- /*! adapterjs - v0.12.2 - 2015-10-19 */
1+ /*! adapterjs - v0.12.3 - 2015-11-16 */
22
33// Adapter's interface.
44var AdapterJS = AdapterJS || { } ;
@@ -17,7 +17,7 @@ AdapterJS.options = AdapterJS.options || {};
1717// AdapterJS.options.hidePluginInstallPrompt = true;
1818
1919// AdapterJS version
20- AdapterJS . VERSION = '0.12.2 ' ;
20+ AdapterJS . VERSION = '0.12.3 ' ;
2121
2222// This function will be called when the WebRTC API is ready to be used
2323// Whether it is the native implementation (Chrome, Firefox, Opera) or
@@ -607,7 +607,7 @@ if (navigator.mozGetUserMedia) {
607607
608608 createIceServers = function ( urls , username , password ) {
609609 var iceServers = [ ] ;
610- for ( i = 0 ; i < urls . length ; i ++ ) {
610+ for ( var i = 0 ; i < urls . length ; i ++ ) {
611611 var iceServer = createIceServer ( urls [ i ] , username , password ) ;
612612 if ( iceServer !== null ) {
613613 iceServers . push ( iceServer ) ;
@@ -697,7 +697,7 @@ if (navigator.mozGetUserMedia) {
697697 'username' : username
698698 } ;
699699 } else {
700- for ( i = 0 ; i < urls . length ; i ++ ) {
700+ for ( var i = 0 ; i < urls . length ; i ++ ) {
701701 var iceServer = createIceServer ( urls [ i ] , username , password ) ;
702702 if ( iceServer !== null ) {
703703 iceServers . push ( iceServer ) ;
@@ -999,12 +999,13 @@ if (navigator.mozGetUserMedia) {
999999 return ;
10001000 }
10011001
1002- var streamId
1002+ var streamId ;
10031003 if ( stream === null ) {
10041004 streamId = '' ;
1005- }
1006- else {
1007- stream . enableSoundTracks ( true ) ; // TODO: remove on 0.12.0
1005+ } else {
1006+ if ( typeof stream . enableSoundTracks !== 'undefined' ) {
1007+ stream . enableSoundTracks ( true ) ;
1008+ }
10081009 streamId = stream . id ;
10091010 }
10101011
@@ -1100,11 +1101,16 @@ if (navigator.mozGetUserMedia) {
11001101
11011102 for ( prop in properties ) {
11021103 propName = properties [ prop ] ;
1103- if ( propName . slice ( 0 , 2 ) == 'on' && srcElem [ propName ] != null ) {
1104- if ( isIE ) {
1105- destElem . attachEvent ( propName , srcElem [ propName ] ) ;
1104+
1105+ if ( typeof ( propName . slice ) === 'function' ) {
1106+ if ( propName . slice ( 0 , 2 ) == 'on' && srcElem [ propName ] != null ) {
1107+ if ( isIE ) {
1108+ destElem . attachEvent ( propName , srcElem [ propName ] ) ;
1109+ } else {
1110+ destElem . addEventListener ( propName . slice ( 2 ) , srcElem [ propName ] , false )
1111+ }
11061112 } else {
1107- destElem . addEventListener ( propName . slice ( 2 ) , srcElem [ propName ] , false )
1113+ //TODO (http://jira.temasys.com.sg/browse/TWP-328) Forward non-event properties ?
11081114 }
11091115 }
11101116 }
@@ -1204,8 +1210,10 @@ if (navigator.mozGetUserMedia) {
12041210 if ( constraints && constraints . video && ! ! constraints . video . mediaSource ) {
12051211 // intercepting screensharing requests
12061212
1213+ // Invalid mediaSource for firefox, only "screen" and "window" are supported
12071214 if ( constraints . video . mediaSource !== 'screen' && constraints . video . mediaSource !== 'window' ) {
1208- throw new Error ( 'Only "screen" and "window" option is available as mediaSource' ) ;
1215+ failureCb ( new Error ( 'GetUserMedia: Only "screen" and "window" are supported as mediaSource constraints' ) ) ;
1216+ return ;
12091217 }
12101218
12111219 var updatedConstraints = clone ( constraints ) ;
@@ -1243,10 +1251,11 @@ if (navigator.mozGetUserMedia) {
12431251 baseGetUserMedia = window . navigator . getUserMedia ;
12441252
12451253 navigator . getUserMedia = function ( constraints , successCb , failureCb ) {
1246-
12471254 if ( constraints && constraints . video && ! ! constraints . video . mediaSource ) {
12481255 if ( window . webrtcDetectedBrowser !== 'chrome' ) {
1249- throw new Error ( 'Current browser does not support screensharing' ) ;
1256+ // This is Opera, which does not support screensharing
1257+ failureCb ( new Error ( 'Current browser does not support screensharing' ) ) ;
1258+ return ;
12501259 }
12511260
12521261 // would be fine since no methods
@@ -1267,11 +1276,13 @@ if (navigator.mozGetUserMedia) {
12671276
12681277 baseGetUserMedia ( updatedConstraints , successCb , failureCb ) ;
12691278
1270- } else {
1279+ } else { // GUM failed
12711280 if ( error === 'permission-denied' ) {
1272- throw new Error ( 'Permission denied for screen retrieval' ) ;
1281+ failureCb ( new Error ( 'Permission denied for screen retrieval' ) ) ;
12731282 } else {
1274- throw new Error ( 'Failed retrieving selected screen' ) ;
1283+ // NOTE(J-O): I don't think we ever pass in here.
1284+ // A failure to capture the screen does not lead here.
1285+ failureCb ( new Error ( 'Failed retrieving selected screen' ) ) ;
12751286 }
12761287 }
12771288 } ;
@@ -1333,8 +1344,6 @@ if (navigator.mozGetUserMedia) {
13331344 // check if screensharing feature is available
13341345 if ( ! ! AdapterJS . WebRTCPlugin . plugin . HasScreensharingFeature &&
13351346 ! ! AdapterJS . WebRTCPlugin . plugin . isScreensharingAvailable ) {
1336-
1337-
13381347 // set the constraints
13391348 updatedConstraints . video . optional = updatedConstraints . video . optional || [ ] ;
13401349 updatedConstraints . video . optional . push ( {
@@ -1343,7 +1352,8 @@ if (navigator.mozGetUserMedia) {
13431352
13441353 delete updatedConstraints . video . mediaSource ;
13451354 } else {
1346- throw new Error ( 'Your WebRTC plugin does not support screensharing' ) ;
1355+ failureCb ( new Error ( 'Your version of the WebRTC plugin does not support screensharing' ) ) ;
1356+ return ;
13471357 }
13481358 baseGetUserMedia ( updatedConstraints , successCb , failureCb ) ;
13491359 } ) ;
@@ -1355,6 +1365,9 @@ if (navigator.mozGetUserMedia) {
13551365 getUserMedia = window . navigator . getUserMedia ;
13561366 }
13571367
1368+ // For chrome, use an iframe to load the screensharing extension
1369+ // in the correct domain.
1370+ // Modify here for custom screensharing extension in chrome
13581371 if ( window . webrtcDetectedBrowser === 'chrome' ) {
13591372 var iframe = document . createElement ( 'iframe' ) ;
13601373
@@ -1363,7 +1376,6 @@ if (navigator.mozGetUserMedia) {
13631376 } ;
13641377
13651378 iframe . src = 'https://cdn.temasys.com.sg/skylink/extensions/detectRTC.html' ;
1366- //'https://temasys-cdn.s3.amazonaws.com/skylink/extensions/detection-script-dev/detectRTC.html';
13671379 iframe . style . display = 'none' ;
13681380
13691381 ( document . body || document . documentElement ) . appendChild ( iframe ) ;
0 commit comments