Skip to content

Commit 6266e3f

Browse files
Merge pull request #1839 from twilio/2.22.2_prep
2.22.2 prep
2 parents 45dab13 + ffe7113 commit 6266e3f

File tree

6 files changed

+105
-3
lines changed

6 files changed

+105
-3
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@ The Twilio Programmable Video SDKs use [Semantic Versioning](http://www.semver.o
22

33
**Version 1.x reached End of Life on September 8th, 2021.** See the changelog entry [here](https://www.twilio.com/changelog/end-of-life-complete-for-unsupported-versions-of-the-programmable-video-sdk). Support for the 1.x version ended on December 4th, 2020.
44

5+
2.22.2 (July 25, 2022)
6+
======================
7+
8+
Changes
9+
-------
10+
11+
- `isSupported` flag now returns `false` if the browser does not support the Unified Plan SDP format. (VIDEO-10307)
12+
13+
The following is a list of browsers with Unified Plan as the default SDP format.
14+
- Chrome 72+
15+
- Safari 12.1+
16+
- Firefox 38+
17+
518
2.22.1 (July 11, 2022)
619
======================
720

@@ -85,7 +98,7 @@ Bug Fixes
8598
Bug Fixes
8699
---------
87100

88-
- Fixed an issue where some extraneous errors were logged to console when a video track was stopped. (VIDEO-9511)
101+
- Fixed an issue where publishing a video track sometimes caused a failure with "Unhandled exception: Client is unable to create or apply a local media description". (VIDEO-9511)
89102
- Fixed an issue where the `dimensionsChanged` event was not firing when the track dimensions first became available. (VIDEO-3576)
90103
- Removed references to node dependencies that causes build errors on Angular and Vue. (VIDEO-9282)
91104
- Fixed an issue where incorrect device was detected when using iPad in Desktop Website mode. (VIDEO-8282)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Releases of twilio-video.js are hosted on a CDN, and you can include these
7474
directly in your web app using a <script> tag.
7575

7676
```html
77-
<script src="//sdk.twilio.com/js/video/releases/2.22.1/twilio-video.min.js"></script>
77+
<script src="//sdk.twilio.com/js/video/releases/2.22.2/twilio-video.min.js"></script>
7878

7979
```
8080

lib/util/support.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const { guessBrowser, support: isWebRTCSupported } = require('../webrtc/util');
4+
const { getSdpFormat } = require('../webrtc/util/sdp');
45
const { isAndroid, isMobile, isNonChromiumEdge, rebrandedChromeBrowser, mobileWebKitBrowser } = require('./browserdetection');
56

67
const SUPPORTED_CHROME_BASED_BROWSERS = [
@@ -41,6 +42,7 @@ function isSupported() {
4142

4243
return !!browser
4344
&& isWebRTCSupported()
45+
&& getSdpFormat() === 'unified'
4446
&& (!rebrandedChrome || SUPPORTED_CHROME_BASED_BROWSERS.includes(rebrandedChrome))
4547
&& !isNonChromiumEdge(browser)
4648
&& (!mobileWebKit || SUPPORTED_MOBILE_WEBKIT_BASED_BROWSERS.includes(mobileWebKit))

lib/webrtc/util/sdp.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ function checkIfSdpSemanticsIsSupported() {
3535
// instantiation of more than one RTCPeerConnection.
3636
var chromeSdpFormat = null;
3737

38+
/**
39+
* Clear cached Chrome's SDP format
40+
*/
41+
function clearChromeCachedSdpFormat() {
42+
chromeSdpFormat = null;
43+
}
44+
3845
/**
3946
* Get Chrome's default SDP format.
4047
* @returns {'planb'|'unified'}
@@ -43,12 +50,14 @@ function getChromeDefaultSdpFormat() {
4350
if (!chromeSdpFormat) {
4451
if (typeof RTCPeerConnection !== 'undefined'
4552
&& 'addTransceiver' in RTCPeerConnection.prototype) {
53+
const pc = new RTCPeerConnection();
4654
try {
47-
new RTCPeerConnection().addTransceiver('audio');
55+
pc.addTransceiver('audio');
4856
chromeSdpFormat = 'unified';
4957
} catch (e) {
5058
chromeSdpFormat = 'planb';
5159
}
60+
pc.close();
5261
} else {
5362
chromeSdpFormat = 'planb';
5463
}
@@ -299,6 +308,7 @@ function updateUnifiedPlanTrackIdsToSSRCs(trackIdsToSSRCs, sdp) {
299308
return updateTrackIdsToSSRCs(getUnifiedPlanTrackIdsToSSRCs, trackIdsToSSRCs, sdp);
300309
}
301310

311+
exports.clearChromeCachedSdpFormat = clearChromeCachedSdpFormat;
302312
exports.getSdpFormat = getSdpFormat;
303313
exports.getMediaSections = getMediaSections;
304314
exports.getPlanBTrackIds = getPlanBTrackIds;

test/lib/mockwebrtc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ class RTCSessionDescription {
105105
}
106106
}
107107

108+
class RTCRtpTransceiver {
109+
constructor() {
110+
111+
}
112+
get currentDirection() {
113+
return 'foo';
114+
}
115+
}
116+
108117
class RTCPeerConnection extends EventEmitter {
109118
constructor() {
110119
super();
@@ -116,6 +125,10 @@ class RTCPeerConnection extends EventEmitter {
116125
this.signalingState = 'stable';
117126
}
118127

128+
addTransceiver() {
129+
130+
}
131+
119132
createOffer() {
120133
return Promise.resolve(new RTCSessionDescription({ type: 'offer', sdp: DUMMY_SDP }));
121134
}
@@ -232,6 +245,7 @@ function mockWebRTC(_global) {
232245
_global.webkitMediaStream = MediaStream;
233246
_global.MediaStream = MediaStream;
234247
_global.RTCDataChannel = RTCDataChannel;
248+
_global.RTCRtpTransceiver = RTCRtpTransceiver;
235249
_global.RTCPeerConnection = RTCPeerConnection;
236250
_global.RTCSessionDescription = RTCSessionDescription;
237251
_global.attachMediaStream = attachMediaStream;
@@ -250,6 +264,7 @@ module.exports.webkitMediaStream = MediaStream;
250264
module.exports.getUserMedia = getUserMedia;
251265
module.exports.navigator = navigator;
252266
module.exports.RTCDataChannel = RTCDataChannel;
267+
module.exports.RTCRtpTransceiver = RTCRtpTransceiver;
253268
module.exports.DUMMY_SDP = DUMMY_SDP;
254269
module.exports.RTCPeerConnection = RTCPeerConnection;
255270
module.exports.RTCSessionDescription = RTCSessionDescription;

test/unit/spec/util/support.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const assert = require('assert');
44
const isSupported = require('../../../../lib/util/support');
5+
const { clearChromeCachedSdpFormat } = require('../../../../lib/webrtc/util/sdp');
56

67
describe('isSupported', () => {
78
let oldAgent;
@@ -10,6 +11,7 @@ describe('isSupported', () => {
1011
});
1112

1213
afterEach(() => {
14+
clearChromeCachedSdpFormat();
1315
navigator.userAgent = oldAgent;
1416
if (global.chrome) {
1517
delete global.chrome;
@@ -210,4 +212,64 @@ describe('isSupported', () => {
210212
assert.equal(isSupported(), false);
211213
});
212214
});
215+
216+
describe('return false when sdp format is plan-b', () => {
217+
describe('and browser is chrome', () => {
218+
let oldRTCPeerConnection;
219+
let oldUserAgent;
220+
221+
beforeEach(() => {
222+
oldUserAgent = navigator.userAgent;
223+
navigator.userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36';
224+
oldRTCPeerConnection = global.RTCPeerConnection;
225+
});
226+
227+
afterEach(() => {
228+
navigator.userAgent = oldUserAgent;
229+
global.RTCPeerConnection = oldRTCPeerConnection;
230+
});
231+
232+
it('and RTCPeerConnection.prototype.addTransceiver is not supported', () => {
233+
global.RTCPeerConnection.prototype = {};
234+
assert.equal(isSupported(), false);
235+
});
236+
237+
it('and RTCPeerConnection.prototype.addTransceiver throws an exception', () => {
238+
global.RTCPeerConnection = function() {
239+
this.addTransceiver = function() {
240+
throw new Error();
241+
};
242+
this.close = function() {};
243+
};
244+
global.RTCPeerConnection.prototype.addTransceiver = function() {};
245+
assert.equal(isSupported(), false);
246+
});
247+
});
248+
249+
describe('and browser is safari', () => {
250+
let oldUserAgent;
251+
let oldRTCRtpTransceiver;
252+
253+
beforeEach(() => {
254+
oldUserAgent = navigator.userAgent;
255+
navigator.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13 Safari/605.1.15';
256+
oldRTCRtpTransceiver = global.RTCRtpTransceiver;
257+
});
258+
259+
afterEach(() => {
260+
navigator.userAgent = oldUserAgent;
261+
global.RTCRtpTransceiver = oldRTCRtpTransceiver;
262+
});
263+
264+
it('and RTCRtpTransceiver is not supported', () => {
265+
delete global.RTCRtpTransceiver;
266+
assert.equal(isSupported(), false);
267+
});
268+
269+
it('and RTCRtpTransceiver is supported but currentDirection is missing', () => {
270+
delete global.RTCRtpTransceiver.prototype.currentDirection;
271+
assert.equal(isSupported(), false);
272+
});
273+
});
274+
});
213275
});

0 commit comments

Comments
 (0)