Skip to content

Commit

Permalink
Merge pull request #2022 from twilio/prep-2-28-0
Browse files Browse the repository at this point in the history
Prep for 2.28.0
  • Loading branch information
manjeshbhargav authored Sep 14, 2023
2 parents c5d9002 + e96a434 commit b1f6920
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ The Twilio Programmable Video SDKs use [Semantic Versioning](http://www.semver.o

**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.

2.28.0 (September 14, 2023)
===========================

Bug Fixes
---------

- Fixed a bug where a Chrome iOS 17 Participant's audio with Krisp Noise Cancellation did not recover after interacting with a system popup. (VIDEO-13012)
- Fixed a bug where a Chrome iOS 17 Participant's audio with Krisp Noise Cancellation did not recover after invoking Siri. (VIDEO-13013)

2.27.0 (March 21, 2023)
=======================

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Releases of twilio-video.js are hosted on a CDN, and you can include these
directly in your web app using a <script> tag.

```html
<script src="//sdk.twilio.com/js/video/releases/2.27.0/twilio-video.min.js"></script>
<script src="//sdk.twilio.com/js/video/releases/2.28.0/twilio-video.min.js"></script>
```

Using this method, twilio-video.js will set a browser global:
Expand Down
33 changes: 24 additions & 9 deletions lib/media/track/localmediatrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const { getUserMedia } = require('../../webrtc');
const { isIOS } = require('../../util/browserdetection');

const { capitalize, defer, isUserMediaTrack, waitForSometime, waitForEvent } = require('../../util');
const { capitalize, defer, waitForSometime, waitForEvent } = require('../../util');
const { typeErrors: { ILLEGAL_INVOKE } } = require('../../util/constants');
const detectSilentAudio = require('../../util/detectsilentaudio');
const detectSilentVideo = require('../../util/detectsilentvideo');
Expand Down Expand Up @@ -32,7 +32,6 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
*/
constructor(mediaStreamTrack, options) {
const workaroundWebKitBug1208516 = isIOS()
&& isUserMediaTrack(mediaStreamTrack)
&& typeof document === 'object'
&& typeof document.addEventListener === 'function'
&& typeof document.visibilityState === 'string';
Expand Down Expand Up @@ -82,6 +81,9 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
_isCreatedByCreateLocalTracks: {
value: options.isCreatedByCreateLocalTracks
},
_noiseCancellation: {
value: options.noiseCancellation || null
},
_trackSender: {
value: mediaTrackSender
},
Expand Down Expand Up @@ -290,10 +292,23 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
* @returns {function} Clean up listeners attached by the workaround
*/
function restartWhenInadvertentlyStopped(localMediaTrack) {
const { _log: log, kind } = localMediaTrack;
const detectSilence = { audio: detectSilentAudio, video: detectSilentVideo }[kind];

let { _dummyEl: el, mediaStreamTrack } = localMediaTrack;
const {
_log: log,
kind,
_noiseCancellation: noiseCancellation
} = localMediaTrack;

const detectSilence = {
audio: detectSilentAudio,
video: detectSilentVideo
}[kind];

const getSourceMediaStreamTrack = () => noiseCancellation
? noiseCancellation.sourceTrack
: localMediaTrack.mediaStreamTrack;

let { _dummyEl: el } = localMediaTrack;
let mediaStreamTrack = getSourceMediaStreamTrack();
let trackChangeInProgress = null;

function checkSilence() {
Expand All @@ -318,11 +333,11 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
function shouldReacquireTrack() {
const {
_workaroundWebKitBug1208516Cleanup,
isStopped,
mediaStreamTrack: { muted }
isStopped
} = localMediaTrack;

const isInadvertentlyStopped = isStopped && !!_workaroundWebKitBug1208516Cleanup;
const { muted } = getSourceMediaStreamTrack();

// NOTE(mmalavalli): Restart the LocalMediaTrack if:
// 1. The app is foregrounded, and
Expand All @@ -345,7 +360,7 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
localMediaTrack._restart().finally(() => {
el = localMediaTrack._dummyEl;
removeMediaStreamTrackListeners();
mediaStreamTrack = localMediaTrack.mediaStreamTrack;
mediaStreamTrack = getSourceMediaStreamTrack();
addMediaStreamTrackListeners();
trackChangeInProgress.resolve();
trackChangeInProgress = null;
Expand Down
2 changes: 0 additions & 2 deletions lib/media/track/localvideotrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { isIOS } = require('../../util/browserdetection');
const detectSilentVideo = require('../../util/detectsilentvideo');
const mixinLocalMediaTrack = require('./localmediatrack');
const VideoTrack = require('./videotrack');
const { isUserMediaTrack } = require('../../util');

const LocalMediaVideoTrack = mixinLocalMediaTrack(VideoTrack);

Expand Down Expand Up @@ -38,7 +37,6 @@ class LocalVideoTrack extends LocalMediaVideoTrack {
constructor(mediaStreamTrack, options) {
options = Object.assign({
workaroundSilentLocalVideo: isIOS()
&& isUserMediaTrack(mediaStreamTrack)
&& typeof document !== 'undefined'
&& typeof document.createElement === 'function'
}, options);
Expand Down
13 changes: 0 additions & 13 deletions lib/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,18 +825,6 @@ function isChromeScreenShareTrack(track) {
return util.guessBrowser() === 'chrome' && track.kind === 'video' && 'displaySurface' in track.getSettings();
}


/**
* returns true if given MediaStreamTrack is a user media track
* @private
* @param {MediaStreamTrack} track
* @returns {boolean}
*/
function isUserMediaTrack(track) {
// NOTE(mpatwardhan): tracks obtained from getUserMedia have a deviceId in its settings.
return typeof track.getSettings().deviceId === 'string';
}

/**
* Returns a promise that resolve after timeoutMS have passed.
* @param {number} timeoutMS - time to wait in milliseconds.
Expand Down Expand Up @@ -893,6 +881,5 @@ exports.trackPublicationClass = trackPublicationClass;
exports.valueToJSON = valueToJSON;
exports.withJitter = withJitter;
exports.isChromeScreenShareTrack = isChromeScreenShareTrack;
exports.isUserMediaTrack = isUserMediaTrack;
exports.waitForSometime = waitForSometime;
exports.waitForEvent = waitForEvent;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "twilio-video",
"title": "Twilio Video",
"description": "Twilio Video JavaScript Library",
"version": "2.27.1-dev",
"version": "2.28.0-dev",
"homepage": "https://twilio.com",
"author": "Mark Andrus Roberts <mroberts@twilio.com>",
"contributors": [
Expand Down
9 changes: 4 additions & 5 deletions test/integration/spec/preflight.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ const runPreflight = require('../../../es5/index').runPreflight;
const getToken = require('../../lib/token');
const defaults = require('../../lib/defaults');
const { randomName } = require('../../lib/util');
const { isFirefox, isSafari } = require('../../lib/guessbrowser');
const { isSafari } = require('../../lib/guessbrowser');

const expectedProgress = [
'mediaAcquired',
'connected',
'mediaSubscribed',
'iceConnected',
'mediaStarted'
'mediaStarted',
'peerConnectionConnected'
];
if (!isFirefox) {
expectedProgress.push('peerConnectionConnected');
}

if (!isSafari) {
expectedProgress.push('dtlsConnected');
}
Expand Down

0 comments on commit b1f6920

Please sign in to comment.