Skip to content

Commit 4bb7e0b

Browse files
author
johache
committed
Merge branch 'development'
2 parents 03b13d5 + 5b103f6 commit 4bb7e0b

File tree

11 files changed

+228
-76
lines changed

11 files changed

+228
-76
lines changed

Gruntfile.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = function(grunt) {
88
grunt.loadNpmTasks('grunt-contrib-compress');
99
grunt.loadNpmTasks('grunt-contrib-yuidoc');
1010
grunt.loadNpmTasks('grunt-replace');
11+
grunt.loadNpmTasks('grunt-include-replace');
1112
grunt.loadNpmTasks('grunt-karma');
1213

1314
grunt.initConfig({
@@ -22,6 +23,9 @@ module.exports = function(grunt) {
2223

2324
bamboo: 'bamboo',
2425

26+
pluginInfoRoot: grunt.option('pluginInfoRoot') || '<%= source %>',
27+
pluginInfoFile: grunt.option('pluginInfoFile') || 'pluginInfo.js',
28+
2529
clean: {
2630
production: ['<%= production %>/'],
2731
bamboo: ['<%= bamboo %>/'],
@@ -107,6 +111,22 @@ module.exports = function(grunt) {
107111
}]
108112
}
109113
},
114+
115+
includereplace: {
116+
production: {
117+
options: {
118+
// Task-specific options go here.
119+
prefix: '@@',
120+
includesDir: '<%= pluginInfoRoot %>/',
121+
},
122+
// Files to perform replacements and includes with
123+
src: [
124+
'<%= production %>/*.js',
125+
],
126+
// Destination directory to copy files to
127+
dest: './'
128+
}
129+
},
110130

111131
jshint: {
112132
build: {
@@ -243,19 +263,34 @@ module.exports = function(grunt) {
243263
grunt.log.writeln('bamboo/vars file successfully created');
244264
});
245265

266+
grunt.registerTask('CheckPluginInfo', 'Checks for existing config file', function() {
267+
var fullPath = grunt.config.get('pluginInfoRoot') + '/' + grunt.config.get('pluginInfoFile');
268+
grunt.verbose.writeln('Checking that the plugin info file exists.');
269+
grunt.verbose.writeln('Privided Path : ' + fullPath);
270+
if (grunt.file.exists(fullPath)) {
271+
grunt.log.oklns('Plugin info file found.');
272+
} else {
273+
grunt.fail.fatal('Plugin info file does not exist : ' + fullPath);
274+
}
275+
});
276+
246277
grunt.registerTask('dev', [
278+
'CheckPluginInfo',
247279
'versionise',
248280
'clean:production',
249281
'concat',
250282
'replace:production',
283+
'includereplace:production',
251284
'uglify'
252285
]);
253286

254287
grunt.registerTask('publish', [
288+
'CheckPluginInfo',
255289
'versionise',
256290
'clean:production',
257291
'concat',
258292
'replace',
293+
'includereplace',
259294
'uglify',
260295
'yuidoc'
261296
]);

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "adapterjs",
33
"description": "Creating a common API for WebRTC in the browser",
4-
"version": "0.12.2",
4+
"version": "0.12.3",
55
"homepage": "https://temasys.github.io/",
66
"author": {
77
"name": "Temasys Communications Pte. Ltd.",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "adapterjs",
33
"description": "Creating a common API for WebRTC in the browser",
4-
"version": "0.12.2",
4+
"version": "0.12.3",
55
"homepage": "https://temasys.github.io/",
66
"author": {
77
"name": "Temasys Communications Pte. Ltd.",
@@ -33,6 +33,7 @@
3333
"grunt-contrib-jshint": "0.11.2",
3434
"grunt-contrib-uglify": "0.9.1",
3535
"grunt-contrib-yuidoc": "0.7.0",
36+
"grunt-include-replace": "^3.2.0",
3637
"grunt-karma": "^0.12.0",
3738
"grunt-replace": "0.7.9",
3839
"karma": "^0.13.2",

publish/adapter.debug.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! adapterjs - v0.12.2 - 2015-10-19 */
1+
/*! adapterjs - v0.12.3 - 2015-11-16 */
22

33
// Adapter's interface.
44
var 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
}

publish/adapter.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

publish/adapter.screenshare.js

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! adapterjs - v0.12.2 - 2015-10-19 */
1+
/*! adapterjs - v0.12.3 - 2015-11-16 */
22

33
// Adapter's interface.
44
var 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);

publish/adapter.screenshare.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)