Skip to content

Commit 5393ac2

Browse files
authored
Merge pull request #272 from Temasys/development
0.14.3
2 parents 93fe8e1 + b171626 commit 5393ac2

File tree

9 files changed

+356
-42
lines changed

9 files changed

+356
-42
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AdapterJS provides polyfills and cross-browser helpers for WebRTC. It wraps arou
2222
| ----------------- | ------------ | ------------------------ | ------------------------- |
2323
| Chrome \ Chromium | `38` | MacOS / Win / Ubuntu / Android | Yes (w [Extension](https://chrome.google.com/webstore/detail/skylink-webrtc-tools/ljckddiekopnnjoeaiofddfhgnbdoafc)) |
2424
| Firefox | `33` | MacOS / Win / Ubuntu / Android | Yes (w [Extension for `51` and below](https://addons.mozilla.org/en-US/firefox/addon/skylink-webrtc-tools/)) |
25-
| Opera | `26` | MacOS / Win / Ubuntu / Android | - |
25+
| Opera | `26` | MacOS / Win / Ubuntu / Android | Yes (if configured with extension) |
2626
| Edge | `13.10547`^ | Win | - |
2727
| Bowser | `0.6.1` | iOS 9.x only** | - |
2828
| Safari (Plugin) | `7` | MacOS | Yes ([custom build Plugin](https://temasys.io/plugin/#commercial-licensing)) |
@@ -257,6 +257,59 @@ window.navigator.getUserMedia({
257257
});
258258
```
259259

260+
**List of valid screensharing (`mediaSource`) sources:**
261+
262+
| Sources | Description | Browsers that supports it |
263+
| ------- | ----------- | --------- |
264+
| `"window"` | Fetches the list of application windows | Chrome, Opera, Firefox, IE, Safari |
265+
| `"screen"` | Fetches the list of display screens | Chrome, Opera, Firefox, IE, Safari |
266+
| `"tab"` | Fetches the list of browser tabs | Chrome, Opera |
267+
| `"browser"` | Fetches the list of browser windows | Firefox (Requires to configure `about:config` to enable `media.getusermedia.browser.enabled`) |
268+
| `"application"` | Fetches the list of applications | Firefox |
269+
| `"camera"` | Fetches the list of cameras | Firefox |
270+
| `["tab", "audio"]` | Fetches `"tab"` with its audio | Chrome, Opera (Enable `constraints.audio` to retrieve tab audio) |
271+
| `["window", "screen"]` | Fetches `"screen"` and `"window"` | Chrome, Opera, IE, Safari |
272+
| `["window", "screen", "tab"]` | Fetches `"screen"`, `"window"` and `"tab"` | Chrome, Opera |
273+
| `["window", "tab"]` | Fetches `"window"` and `"tab"` | Chrome, Opera |
274+
| `["screen", "tab"]` | Fetches `"screen"` and `"tab"` | Chrome, Opera |
275+
| `AdapterJS.WebRTCPlugin.plugin.screensharingKeys.screenOrWindow` | Same as `["window","screen"]` | IE, Safari |
276+
| `AdapterJS.WebRTCPlugin.plugin.screensharingKeys.screensharingKey` | Deprecated. Same as `["window","screen"]`. | IE, Safari |
277+
| `AdapterJS.WebRTCPlugin.plugin.screensharingKeys.screen` | Same as `"screen"` | IE, Safari |
278+
| `AdapterJS.WebRTCPlugin.plugin.screensharingKeys.window` | Deprecated. Same as `"window"`. | IE, Safari |
279+
280+
281+
**Configuring extension settings:**
282+
283+
To configure your AdapterJS screensharing extensions, configure this before referencing the script for `adapter.screenshare.js` as an example:
284+
285+
```
286+
var AdapterJS = {};
287+
288+
/**
289+
* Configure extension settings. For developers using "adapter.screenshare.js"
290+
*/
291+
AdapterJS.extensionInfo = {
292+
chrome: {
293+
// Configure the extension ID for Chrome
294+
extensionId: 'xxx',
295+
// Configure the extension webstore link for Chrome
296+
extensionLink: 'xxx',
297+
// Configure the extension iframe link (detectRTC) for Chrome - for older Chrome extension codebase
298+
iframeLink: 'xxx'
299+
},
300+
firefox: {
301+
// Configure the addon link (legacy if available and uploaded before restriction) for Firefox 51 and below
302+
extensionLink: 'xxx'
303+
},
304+
opera: {
305+
// Configure the extension ID for Opera
306+
extensionId: 'xxx',
307+
// Configure the extension webstore link for Opera
308+
extensionLink: 'xxx'
309+
}
310+
};
311+
```
312+
260313
## Setup this project
261314
1. Copy this repository with submodules (`git clone --recursive ...`), or run `git submodule init` and `git submodule update`.
262315
2. Install or update to at lest version `0.10.26` of node and version `1.4.6 `of npm.

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.14.2",
4+
"version": "0.14.3",
55
"homepage": "https://temasys.github.io/",
66
"author": {
77
"name": "Temasys Communications Pte. Ltd.",

package.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.14.2",
4+
"version": "0.14.3",
55
"homepage": "https://temasys.github.io/",
66
"author": {
77
"name": "Temasys Communications Pte. Ltd.",

publish/adapter.debug.js

Lines changed: 126 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! adapterjs - v0.14.2-6d236da - 2017-05-22 */
1+
/*! adapterjs - v0.14.3-6d236da - 2017-05-24 */
22

33
// Adapter's interface.
44
var AdapterJS = AdapterJS || {};
@@ -12,7 +12,7 @@ AdapterJS.options = AdapterJS.options || {};
1212
// AdapterJS.options.hidePluginInstallPrompt = true;
1313

1414
// AdapterJS version
15-
AdapterJS.VERSION = '0.14.2-6d236da';
15+
AdapterJS.VERSION = '0.14.3-6d236da';
1616

1717
// This function will be called when the WebRTC API is ready to be used
1818
// Whether it is the native implementation (Chrome, Firefox, Opera) or
@@ -636,6 +636,11 @@ if ( (navigator.mozGetUserMedia ||
636636
///////////////////////////////////////////////////////////////////
637637
// INJECTION OF GOOGLE'S ADAPTER.JS CONTENT
638638

639+
// Store the original native RTCPC in msRTCPeerConnection object
640+
if (navigator.userAgent.match(/Edge\/(\d+).(\d+)$/) && window.RTCPeerConnection) {
641+
window.msRTCPeerConnection = window.RTCPeerConnection;
642+
}
643+
639644
/* jshint ignore:start */
640645
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.adapter = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(requirecopy,module,exports){
641646
/* eslint-env node */
@@ -862,6 +867,15 @@ SDPUtils.parseSsrcMedia = function(line) {
862867
return parts;
863868
};
864869

870+
// Extracts the MID (RFC 5888) from a media section.
871+
// returns the MID or undefined if no mid line was found.
872+
SDPUtils.getMid = function(mediaSection) {
873+
var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];
874+
if (mid) {
875+
return mid.substr(6);
876+
}
877+
}
878+
865879
// Extracts DTLS parameters from SDP media section or sessionpart.
866880
// FIXME: for consistency with other functions this should only
867881
// get the fingerprint line as input. See also getIceParameters.
@@ -873,10 +887,11 @@ SDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {
873887
return line.indexOf('a=fingerprint:') === 0;
874888
})[0].substr(14);
875889
// Note: a=setup line is ignored since we use the 'auto' role.
890+
// Note2: 'algorithm' is not case sensitive except in Edge.
876891
var dtlsParameters = {
877892
role: 'auto',
878893
fingerprints: [{
879-
algorithm: fpLine.split(' ')[0],
894+
algorithm: fpLine.split(' ')[0].toLowerCase(),
880895
value: fpLine.split(' ')[1]
881896
}]
882897
};
@@ -982,8 +997,21 @@ SDPUtils.writeRtpDescription = function(kind, caps) {
982997
sdp += SDPUtils.writeFmtp(codec);
983998
sdp += SDPUtils.writeRtcpFb(codec);
984999
});
985-
// FIXME: add headerExtensions, fecMechanismş and rtcp.
1000+
var maxptime = 0;
1001+
caps.codecs.forEach(function(codec) {
1002+
if (codec.maxptime > maxptime) {
1003+
maxptime = codec.maxptime;
1004+
}
1005+
});
1006+
if (maxptime > 0) {
1007+
sdp += 'a=maxptime:' + maxptime + '\r\n';
1008+
}
9861009
sdp += 'a=rtcp-mux\r\n';
1010+
1011+
caps.headerExtensions.forEach(function(extension) {
1012+
sdp += SDPUtils.writeExtmap(extension);
1013+
});
1014+
// FIXME: write fecMechanisms.
9871015
return sdp;
9881016
};
9891017

@@ -1024,7 +1052,6 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
10241052
ssrc: primarySsrc,
10251053
codecPayloadType: parseInt(codec.parameters.apt, 10),
10261054
rtx: {
1027-
payloadType: codec.payloadType,
10281055
ssrc: secondarySsrc
10291056
}
10301057
};
@@ -1060,6 +1087,61 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
10601087
return encodingParameters;
10611088
};
10621089

1090+
// parses http://draft.ortc.org/#rtcrtcpparameters*
1091+
SDPUtils.parseRtcpParameters = function(mediaSection) {
1092+
var rtcpParameters = {};
1093+
1094+
var cname;
1095+
// Gets the first SSRC. Note that with RTX there might be multiple
1096+
// SSRCs.
1097+
var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
1098+
.map(function(line) {
1099+
return SDPUtils.parseSsrcMedia(line);
1100+
})
1101+
.filter(function(obj) {
1102+
return obj.attribute === 'cname';
1103+
})[0];
1104+
if (remoteSsrc) {
1105+
rtcpParameters.cname = remoteSsrc.value;
1106+
rtcpParameters.ssrc = remoteSsrc.ssrc;
1107+
}
1108+
1109+
// Edge uses the compound attribute instead of reducedSize
1110+
// compound is !reducedSize
1111+
var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');
1112+
rtcpParameters.reducedSize = rsize.length > 0;
1113+
rtcpParameters.compound = rsize.length === 0;
1114+
1115+
// parses the rtcp-mux attrіbute.
1116+
// Note that Edge does not support unmuxed RTCP.
1117+
var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');
1118+
rtcpParameters.mux = mux.length > 0;
1119+
1120+
return rtcpParameters;
1121+
};
1122+
1123+
// parses either a=msid: or a=ssrc:... msid lines an returns
1124+
// the id of the MediaStream and MediaStreamTrack.
1125+
SDPUtils.parseMsid = function(mediaSection) {
1126+
var parts;
1127+
var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');
1128+
if (spec.length === 1) {
1129+
parts = spec[0].substr(7).split(' ');
1130+
return {stream: parts[0], track: parts[1]};
1131+
}
1132+
var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
1133+
.map(function(line) {
1134+
return SDPUtils.parseSsrcMedia(line);
1135+
})
1136+
.filter(function(parts) {
1137+
return parts.attribute === 'msid';
1138+
});
1139+
if (planB.length > 0) {
1140+
parts = planB[0].value.split(' ');
1141+
return {stream: parts[0], track: parts[1]};
1142+
}
1143+
};
1144+
10631145
SDPUtils.writeSessionBoilerplate = function() {
10641146
// FIXME: sess-id should be an NTP timestamp.
10651147
return 'v=0\r\n' +
@@ -1092,17 +1174,31 @@ SDPUtils.writeMediaSection = function(transceiver, caps, type, stream) {
10921174
sdp += 'a=inactive\r\n';
10931175
}
10941176

1095-
// FIXME: for RTX there might be multiple SSRCs. Not implemented in Edge yet.
10961177
if (transceiver.rtpSender) {
1178+
// spec.
10971179
var msid = 'msid:' + stream.id + ' ' +
10981180
transceiver.rtpSender.track.id + '\r\n';
10991181
sdp += 'a=' + msid;
1182+
1183+
// for Chrome.
11001184
sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +
11011185
' ' + msid;
1186+
if (transceiver.sendEncodingParameters[0].rtx) {
1187+
sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +
1188+
' ' + msid;
1189+
sdp += 'a=ssrc-group:FID ' +
1190+
transceiver.sendEncodingParameters[0].ssrc + ' ' +
1191+
transceiver.sendEncodingParameters[0].rtx.ssrc +
1192+
'\r\n';
1193+
}
11021194
}
11031195
// FIXME: this should be written by writeRtpDescription.
11041196
sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +
11051197
' cname:' + SDPUtils.localCName + '\r\n';
1198+
if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
1199+
sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +
1200+
' cname:' + SDPUtils.localCName + '\r\n';
1201+
}
11061202
return sdp;
11071203
};
11081204

@@ -1127,6 +1223,16 @@ SDPUtils.getDirection = function(mediaSection, sessionpart) {
11271223
return 'sendrecv';
11281224
};
11291225

1226+
SDPUtils.getKind = function(mediaSection) {
1227+
var lines = SDPUtils.splitLines(mediaSection);
1228+
var mline = lines[0].split(' ');
1229+
return mline[0].substr(2);
1230+
};
1231+
1232+
SDPUtils.isRejected = function(mediaSection) {
1233+
return mediaSection.split(' ', 2)[1] === '0';
1234+
};
1235+
11301236
// Expose public methods.
11311237
module.exports = SDPUtils;
11321238

@@ -3765,7 +3871,11 @@ module.exports = {
37653871
}
37663872
var cc = {};
37673873
Object.keys(c).forEach(function(key) {
3768-
if (key === 'require' || key === 'advanced' || key === 'mediaSource') {
3874+
if (key === 'require' || key === 'advanced') {
3875+
return;
3876+
}
3877+
if (typeof c[key] === 'string') {
3878+
cc[key] = c[key];
37693879
return;
37703880
}
37713881
var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};
@@ -3778,6 +3888,15 @@ module.exports = {
37783888
}
37793889
return (name === 'deviceId') ? 'sourceId' : name;
37803890
};
3891+
3892+
// HACK : Specially handling: if deviceId is an object with exact property,
3893+
// change it such that deviceId value is not in exact property
3894+
// Reason : AJS-286 (deviceId in WebRTC samples not in the format specified as specifications)
3895+
if ( oldname('', key) === 'sourceId' && r.exact !== undefined ) {
3896+
r.ideal = r.exact;
3897+
r.exact = undefined;
3898+
}
3899+
37813900
if (r.ideal !== undefined) {
37823901
cc.optional = cc.optional || [];
37833902
var oc = {};

publish/adapter.min.js

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

0 commit comments

Comments
 (0)