webrtc-adapter
Advanced tools
Comparing version 6.1.1 to 6.1.2
{ | ||
"name": "webrtc-adapter", | ||
"version": "6.1.1", | ||
"version": "6.1.2", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -55,4 +55,4 @@ "license": "BSD-3-Clause", | ||
"tape": "^4.0.0", | ||
"travis-multirunner": "^4.0.0" | ||
"travis-multirunner": "^4.4.0" | ||
} | ||
} |
@@ -21,3 +21,3 @@ [![Build Status](https://travis-ci.org/webrtc/adapter.svg)](https://travis-ci.org/webrtc/adapter) | ||
Copy to desired location in your src tree or use a minify/vulcanize tool (node_modules is usually not published with the code). | ||
See [webrtc/samples repo](https://github.com/webrtc/samples/blob/gh-pages/package.json) as an example on how you can do this. | ||
See [webrtc/samples repo](https://github.com/webrtc/samples) as an example on how you can do this. | ||
@@ -24,0 +24,0 @@ #### Prebuilt releases |
@@ -139,8 +139,12 @@ /* | ||
PermissionDeniedError: 'NotAllowedError', | ||
InvalidStateError: 'NotReadableError', | ||
PermissionDismissedError: 'NotAllowedError', | ||
InvalidStateError: 'NotAllowedError', | ||
DevicesNotFoundError: 'NotFoundError', | ||
ConstraintNotSatisfiedError: 'OverconstrainedError', | ||
TrackStartError: 'NotReadableError', | ||
MediaDeviceFailedDueToShutdown: 'NotReadableError', | ||
MediaDeviceKillSwitchOn: 'NotReadableError' | ||
MediaDeviceFailedDueToShutdown: 'NotAllowedError', | ||
MediaDeviceKillSwitchOn: 'NotAllowedError', | ||
TabCaptureError: 'AbortError', | ||
ScreenCaptureError: 'AbortError', | ||
DeviceCaptureError: 'AbortError' | ||
}[e.name] || e.name, | ||
@@ -147,0 +151,0 @@ message: e.message, |
@@ -32,19 +32,23 @@ /* | ||
// Augment the native candidate with the parsed fields. | ||
var nativeCandidate = new NativeRTCIceCandidate(args); | ||
var parsedCandidate = SDPUtils.parseCandidate(args.candidate); | ||
var augmentedCandidate = Object.assign(nativeCandidate, | ||
parsedCandidate); | ||
if (args.candidate && args.candidate.length) { | ||
// Augment the native candidate with the parsed fields. | ||
var nativeCandidate = new NativeRTCIceCandidate(args); | ||
var parsedCandidate = SDPUtils.parseCandidate(args.candidate); | ||
var augmentedCandidate = Object.assign(nativeCandidate, | ||
parsedCandidate); | ||
// Add a serializer that does not serialize the extra attributes. | ||
augmentedCandidate.toJSON = function() { | ||
return { | ||
candidate: augmentedCandidate.candidate, | ||
sdpMid: augmentedCandidate.sdpMid, | ||
sdpMLineIndex: augmentedCandidate.sdpMLineIndex, | ||
usernameFragment: augmentedCandidate.usernameFragment, | ||
// Add a serializer that does not serialize the extra attributes. | ||
augmentedCandidate.toJSON = function() { | ||
return { | ||
candidate: augmentedCandidate.candidate, | ||
sdpMid: augmentedCandidate.sdpMid, | ||
sdpMLineIndex: augmentedCandidate.sdpMLineIndex, | ||
usernameFragment: augmentedCandidate.usernameFragment, | ||
}; | ||
}; | ||
}; | ||
return augmentedCandidate; | ||
return augmentedCandidate; | ||
} | ||
return new NativeRTCIceCandidate(args); | ||
}; | ||
window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype; | ||
@@ -249,2 +253,6 @@ // Hook up the augmented candidate in onicecandidate and | ||
shimSendThrowTypeError: function(window) { | ||
if (!window.RTCPeerConnection) { | ||
return; | ||
} | ||
// Note: Although Firefox >= 57 has a native implementation, the maximum | ||
@@ -251,0 +259,0 @@ // message size can be reset for all data channels at a later stage. |
@@ -20,4 +20,2 @@ /* | ||
if (window.RTCIceGatherer) { | ||
// ORTC defines an RTCIceCandidate object but no constructor. | ||
// Not implemented in Edge. | ||
if (!window.RTCIceCandidate) { | ||
@@ -28,5 +26,2 @@ window.RTCIceCandidate = function(args) { | ||
} | ||
// ORTC does not have a session description object but | ||
// other browsers (i.e. Chrome) that will support both PC and ORTC | ||
// in the future might have this defined already. | ||
if (!window.RTCSessionDescription) { | ||
@@ -33,0 +28,0 @@ window.RTCSessionDescription = function(args) { |
@@ -162,3 +162,3 @@ /* | ||
/Edge\/(\d+).(\d+)$/, 2); | ||
} else if (navigator.mediaDevices && | ||
} else if (window.RTCPeerConnection && | ||
navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari. | ||
@@ -165,0 +165,0 @@ result.browser = 'safari'; |
@@ -43,5 +43,4 @@ /* | ||
it('signals track and stream ids', (done) => { | ||
it('signals stream ids', (done) => { | ||
pc2.ontrack = (e) => { | ||
expect(e.track.id).to.equal(localStream.getTracks()[0].id); | ||
expect(e.streams[0].id).to.equal(localStream.id); | ||
@@ -48,0 +47,0 @@ done(); |
@@ -114,4 +114,6 @@ /* | ||
'a=ssrc:1002 cname:some\r\n'; | ||
let ontrackCount = 0; | ||
pc.ontrack = (e) => { | ||
if (e.track.id === 'track2') { | ||
ontrackCount++; | ||
if (ontrackCount === 2) { | ||
done(); | ||
@@ -118,0 +120,0 @@ } |
@@ -91,3 +91,3 @@ /* | ||
describe('after removing a single track', () => { | ||
it('only a single sender remains', () => { | ||
it('only a single sender with a track remains', () => { | ||
const senders = pc.getSenders(); | ||
@@ -97,3 +97,4 @@ expect(pc.getSenders()).to.have.length(2); | ||
pc.removeTrack(senders[0]); | ||
expect(pc.getSenders()).to.have.length(1); | ||
const sendersWithTrack = pc.getSenders().filter(s => s.track); | ||
expect(sendersWithTrack).to.have.length(1); | ||
}); | ||
@@ -111,6 +112,7 @@ | ||
describe('after removing all tracks', () => { | ||
it('no senders remain', () => { | ||
it('no senders with tracks remain', () => { | ||
const senders = pc.getSenders(); | ||
senders.forEach(sender => pc.removeTrack(sender)); | ||
expect(pc.getSenders()).to.have.length(0); | ||
const sendersWithTrack = pc.getSenders().filter(s => s.track); | ||
expect(sendersWithTrack).to.have.length(0); | ||
}); | ||
@@ -117,0 +119,0 @@ |
@@ -48,2 +48,11 @@ /* | ||
describe('with empty candidate.candidate', () => { | ||
it('does not throw', () => { | ||
const constructor = () => { | ||
return new RTCIceCandidate({sdpMid: 'foo', candidate: ''}); | ||
}; | ||
expect(constructor).not.to.throw(); | ||
}); | ||
}); | ||
describe('icecandidate eventlistener', () => { | ||
@@ -50,0 +59,0 @@ it('can be removed', () => { |
@@ -19,2 +19,4 @@ /* | ||
browsers = ['Safari']; | ||
} else if (process.env.BROWSER === 'Electron') { | ||
browsers = ['electron']; | ||
} else { | ||
@@ -87,2 +89,6 @@ browsers = [process.env.BROWSER]; | ||
}, | ||
electron: { | ||
base: 'Electron', | ||
flags: ['--use-fake-device-for-media-stream'] | ||
}, | ||
firefox: { | ||
@@ -89,0 +95,0 @@ base: 'Firefox', |
@@ -75,12 +75,2 @@ [![Build Status](https://travis-ci.org/webrtc/samples.svg)](https://travis-ci.org/webrtc/samples) | ||
###* Experimental browser support <a id="expBrowser"></a> | ||
You can run the tests in any currently installed browser locally that is supported by Selenium WebDriver but you have to bypass travis-multirunner. Also it only makes sense to use a WebRTC supported browser. | ||
* Remove the `.setBinary()` and `.setChromeBinaryPath()` methods in `test/selenium-lib.js` (these currently point to travis-multirunner scripts that only run on Debian based Linux distributions) or change them to point to a location of your choice. | ||
* Then add the Selenium driver of the browser you want to use to `test/selenium-lib.js`, check Selenium WebDriver [supported browsers](http://www.seleniumhq.org/about/platforms.jsp#browsers) page for more details. | ||
* Then just do the following (replace "opera" with your browser of choice) in order to run all tests | ||
```bash | ||
BROWSER=opera npm test | ||
``` | ||
### Getting crash dumps from karma | ||
@@ -87,0 +77,0 @@ Sometimes Chrome may crash when running the tests. This typically shows up in headless runs as a disconnect: |
@@ -55,6 +55,6 @@ /* | ||
it('detects Safari if navigator.mediaDevices exists', () => { | ||
it('detects Safari if window.RTCPeerConnection exists', () => { | ||
navigator.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) ' + | ||
'AppleWebKit/604.1.6 (KHTML, like Gecko) Version/10.2 Safari/604.1.6'; | ||
navigator.mediaDevices = function() {}; | ||
window.RTCPeerConnection = function() {}; | ||
@@ -61,0 +61,0 @@ const browserDetails = detectBrowser(window); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
825328
71
19251
39