Skip to content

Commit

Permalink
Prep 2.21.0 release (#1729)
Browse files Browse the repository at this point in the history
* Merge Preflight and PlanB removal feature branch (#1702)

* VIDEO-7728 | Better Preflight Errors (#1689)

* Adding better errors on preflight

* lint

* Update docs

* Changelog

* Update docs

* Convert error to string

* Adding timestamp to progress events

* Properly raising signaling errors

* lint

* Update tests

* Mak's feedback

* Update test

* Feature/remove plan b (#1697)

* VIDEO-6587 | Remove Plan B in SDK (#1656)

* Initial implementation.

* Fixing integration tests

* Updating unit tests

* Adding back unit test job

* Removing unneeded case

* Fix build

* Adding rename suggestion

Co-authored-by: Manjesh Malavalli <[email protected]>

* Adding changelog

* Update CHANGELOG.md

Co-authored-by: Manjesh Malavalli <[email protected]>

* Adding ticket number

Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: Manjesh Malavalli <[email protected]>

* Move changelog to 2.20.0 section

* 2.20.0-rc1

* 2.20.0-dev

Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: twilio-ci <[email protected]>

* Fix unit test from merge

* 2.20.0-rc2

* 2.20.0-dev

* Update doc

* Update changelog

Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: twilio-ci <[email protected]>

* Removing framework tests (#1700)

* Convert createLocalTracks to TS (#1694)

* VIDEO-7714 - Convert createLocalTracks to TypeScript

Co-authored-by: joma <[email protected]>
Co-authored-by: charliesantos <[email protected]>

* Update @twilio/webrtc to 4.6.0-rc1 (#1705)

* Update @twilio-webrtc to RC

Co-authored-by: joma <[email protected]>

* 2.21.0-rc1

* 2.21.0-dev

* merge from master

* VIDEO-8791 - Adding extra information into CHANGELOG (#1716)

* Adding extra information into CHANGELOG

* 2.21.0-rc2

* 2.21.0-dev

* VIDEO-8647 - Fixing Chrome Docker Image (#1718)

* VIDEO-8647 Fixing docker images build for Chrome

* VIDEO-8954: Adding in extra links and details to the CHANGELOG entry (#1722)

* VIDEO-8954 - Adding in extra links and details to the CHANGELOG entry

* VIDEO-8647 - Fixing Chrome Docker Image (#1718) (#1721) (#1728)

* VIDEO-8647 Fixing docker images build for Chrome

* prep 2.21.0 release

Co-authored-by: Charlemagne Santos <[email protected]>
Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: Manjesh Malavalli <[email protected]>
Co-authored-by: twilio-ci <[email protected]>
Co-authored-by: Makarand Patwardhan <[email protected]>
  • Loading branch information
6 people committed Mar 8, 2022
1 parent d97a4d9 commit 0f25497
Show file tree
Hide file tree
Showing 31 changed files with 179 additions and 127 deletions.
17 changes: 0 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,6 @@ commands:
name: Running Network Tests (environment = << pipeline.parameters.environment >>)
command: scripts/circleci-run-tests.sh
- save-test-results
framework-tests:
steps:
- build
- run:
name: Running Framework Tests
command: scripts/circleci-run-tests.sh
- save-test-results
umd-tests:
steps:
- build
Expand Down Expand Up @@ -237,12 +230,6 @@ jobs:
TEST_STABILITY: << parameters.test_stability >>
executor: machine-executor
steps: [network-tests]
Framework-tests:
environment:
TEST_TYPE: "framework"
BROWSER: "chrome"
executor: docker-with-browser
steps: [framework-tests]
UMD-tests:
environment:
BROWSER: "chrome"
Expand Down Expand Up @@ -435,10 +422,6 @@ workflows:
topology: ["group", "peer-to-peer"]
test_stability: ["stable", "unstable"]
requires: [Build, UnitTests]
- Framework-tests:
context: dockerhub-pulls
name: "framework tests"
requires: [Build, UnitTests]
- UMD-tests:
context: dockerhub-pulls
name: "umd tests"
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@ 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.21.0 (March 8, 2022)
==========================

New Features
------------
- twilio-video.js now supports WKWebView and SFSafariViewController on iOS version 14.3 or later. The [`isSupported` flag](https://sdk.twilio.com/js/video/releases/2.20.1/docs/module-twilio-video.html) relies partly on the [User-Agent string](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) to determine if twilio-video.js officially supports the user's browser. If your application modifies the default value for the User-Agent string, the new value should follow the [correct format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent#syntax).

Additionally, for [iOS applications](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_ios), your application will need to include the [camera usage description](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/plist/info/NSCameraUsageDescription), [microphone usage description](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW25) and [inline media playback](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback) in order for the SDK to work on WKWebView.

Note: As with Safari, WKWebViews only support only one local media track of each kind at a time.

We also would like to thank @cbxp for his [contribution](https://github.com/twilio/twilio-webrtc.js/pull/133). (VIDEO-8374)

Known Issue
-----------

Some [common issues](https://github.com/twilio/twilio-video.js/blob/master/COMMON_ISSUES.md#safari-mobile) such as interruptions on mobile devices which includes, backgrounding the application, or switching between applications can sometimes cause VideoTracks to go black or AudioTracks to stop.

2.20.1 (Feb 17, 2022)
=====================
Bug Fixes
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ View [CHANGELOG.md](https://github.com/twilio/twilio-video.js/blob/master/CHANGE
Browser Support
---------------

| | Chrome | Edge (Chromium) | Firefox | Safari |
| ------------|--------|-----------------|---------|--------|
| **Android** || - || - |
| **iOS** || - | * ||
| **Linux** || - || - |
| **macOS** ||** |||
| **Windows** ||** || - |
| | Chrome | Edge (Chromium) | Firefox | Safari | WebView |
| ------------|--------|-----------------|---------|--------|---------|
| **Android** || - || - | - |
| **iOS** || - | * |||
| **Linux** || - || - | - |
| **macOS** ||** ||| - |
| **Windows** ||** || - | - |

\*\* twilio-video.js supports the [Chromium-based Edge](https://www.microsoftedgeinsider.com/) browser.

Expand Down 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 &lt;script&gt; tag.

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

```

Expand Down Expand Up @@ -235,4 +235,3 @@ License
-------

See [LICENSE.md](https://github.com/twilio/twilio-video.js/blob/master/LICENSE.md).

2 changes: 0 additions & 2 deletions lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const { MediaStreamTrack } = require('@twilio/webrtc');
const { guessBrowser, guessBrowserVersion } = require('@twilio/webrtc/lib/util');
const createCancelableRoomPromise = require('./cancelableroompromise');
const createLocalTracks = require('./createlocaltracks');
const EncodingParametersImpl = require('./encodingparameters');
const LocalParticipant = require('./localparticipant');
const InsightsPublisher = require('./util/insightspublisher');
Expand Down Expand Up @@ -235,7 +234,6 @@ function connect(token, options) {

options = Object.assign({
automaticSubscription: true,
createLocalTracks,
dominantSpeaker: false,
enableDscp: false,
environment: DEFAULT_ENVIRONMENT,
Expand Down
2 changes: 0 additions & 2 deletions lib/createlocaltrack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const defaultCreateLocalTracks = require('./createlocaltracks');
const { DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME } = require('./util/constants');

/**
Expand All @@ -12,7 +11,6 @@ const { DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME } = require('./util/constants');
*/
function createLocalTrack(kind, options) {
options = Object.assign({
createLocalTracks: defaultCreateLocalTracks,
loggerName: DEFAULT_LOGGER_NAME,
logLevel: DEFAULT_LOG_LEVEL,
}, options);
Expand Down
109 changes: 65 additions & 44 deletions lib/createlocaltracks.js → lib/createlocaltracks.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
'use strict';

const asLocalTrack = require('./util').asLocalTrack;
const buildLogLevels = require('./util').buildLogLevels;
const getUserMedia = require('@twilio/webrtc').getUserMedia;
import { CreateLocalTrackOptions, CreateLocalTracksOptions, LocalTrack } from '../tsdef/types';

const { asLocalTrack, buildLogLevels } = require('./util');
const { getUserMedia, MediaStreamTrack } = require('@twilio/webrtc');

const {
LocalAudioTrack,
LocalDataTrack,
LocalVideoTrack
} = require('./media/track/es5');

const MediaStreamTrack = require('@twilio/webrtc').MediaStreamTrack;
const Log = require('./util/log');
const { DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME } = require('./util/constants');
const workaround180748 = require('./webaudio/workaround180748');
Expand All @@ -20,6 +20,19 @@ const workaround180748 = require('./webaudio/workaround180748');
// counter.
let createLocalTrackCalls = 0;


type ExtraLocalTrackOption = CreateLocalTrackOptions & { isCreatedByCreateLocalTracks?: boolean };
type ExtraLocalTrackOptions = { audio: ExtraLocalTrackOption; video: ExtraLocalTrackOption; };

interface InternalOptions extends CreateLocalTracksOptions {
getUserMedia: any;
LocalAudioTrack: any;
LocalDataTrack: any;
LocalVideoTrack: any;
MediaStreamTrack: any;
Log: any;
};

/**
* Request {@link LocalTrack}s. By default, it requests a
* {@link LocalAudioTrack} and a {@link LocalVideoTrack}.
Expand Down Expand Up @@ -77,11 +90,11 @@ let createLocalTrackCalls = 0;
* });
*
*/
function createLocalTracks(options) {
export async function createLocalTracks(options?: CreateLocalTracksOptions): Promise<LocalTrack[]> {
const isAudioVideoAbsent =
!(options && ('audio' in options || 'video' in options));

options = Object.assign({
const fullOptions: InternalOptions = {
audio: isAudioVideoAbsent,
getUserMedia,
loggerName: DEFAULT_LOGGER_NAME,
Expand All @@ -91,80 +104,90 @@ function createLocalTracks(options) {
LocalVideoTrack,
MediaStreamTrack,
Log,
video: isAudioVideoAbsent
}, options);
video: isAudioVideoAbsent,
...options,
};

const logComponentName = `[createLocalTracks #${++createLocalTrackCalls}]`;
const logLevels = buildLogLevels(options.logLevel);
const log = new options.Log('default', logComponentName, logLevels, options.loggerName);
const logLevels = buildLogLevels(fullOptions.logLevel);
const log = new fullOptions.Log('default', logComponentName, logLevels, fullOptions.loggerName);

const localTrackOptions = Object.assign({ log }, fullOptions);

// NOTE(mmalavalli): The Room "name" in "options" was being used
// as the LocalTrack name in asLocalTrack(). So we pass a copy of
// "options" without the "name".
const localTrackOptions = Object.assign({ log }, options);
delete localTrackOptions.name;
// NOTE(joma): CreateLocalTracksOptions type does not really have a "name" property when used publicly by customers.
// But we are passing this property when used internally by other JS files.
// We can update this "any" type once those JS files are converted to TS.
delete (localTrackOptions as any).name;

if (options.audio === false && options.video === false) {
if (fullOptions.audio === false && fullOptions.video === false) {
log.info('Neither audio nor video requested, so returning empty LocalTracks');
return Promise.resolve([]);
return [];
}

if (options.tracks) {
if (fullOptions.tracks) {
log.info('Adding user-provided LocalTracks');
log.debug('LocalTracks:', options.tracks);
return Promise.resolve(options.tracks);
log.debug('LocalTracks:', fullOptions.tracks);
return fullOptions.tracks;
}

const extraLocalTrackOptions = {
audio: options.audio && options.audio.name
? { name: options.audio.name }
const extraLocalTrackOptions: ExtraLocalTrackOptions = {
audio: typeof fullOptions.audio === 'object' && fullOptions.audio.name
? { name: fullOptions.audio.name }
: {},
video: options.video && options.video.name
? { name: options.video.name }
video: typeof fullOptions.video === 'object' && fullOptions.video.name
? { name: fullOptions.video.name }
: {}
};

extraLocalTrackOptions.audio.isCreatedByCreateLocalTracks = true;
extraLocalTrackOptions.video.isCreatedByCreateLocalTracks = true;

if (options.audio && typeof options.audio.workaroundWebKitBug1208516 === 'boolean') {
extraLocalTrackOptions.audio.workaroundWebKitBug1208516 = options.audio.workaroundWebKitBug1208516;
if (typeof fullOptions.audio === 'object' && typeof fullOptions.audio.workaroundWebKitBug1208516 === 'boolean') {
extraLocalTrackOptions.audio.workaroundWebKitBug1208516 = fullOptions.audio.workaroundWebKitBug1208516;
}

if (options.video && typeof options.video.workaroundWebKitBug1208516 === 'boolean') {
extraLocalTrackOptions.video.workaroundWebKitBug1208516 = options.video.workaroundWebKitBug1208516;
if (typeof fullOptions.video === 'object' && typeof fullOptions.video.workaroundWebKitBug1208516 === 'boolean') {
extraLocalTrackOptions.video.workaroundWebKitBug1208516 = fullOptions.video.workaroundWebKitBug1208516;
}

if (options.audio) {
delete options.audio.name;
if (typeof fullOptions.audio === 'object') {
delete fullOptions.audio.name;
}
if (options.video) {
delete options.video.name;
if (typeof fullOptions.video === 'object') {
delete fullOptions.video.name;
}

const mediaStreamConstraints = {
audio: options.audio,
video: options.video
audio: fullOptions.audio,
video: fullOptions.video
};

const workaroundWebKitBug180748 = options.audio && options.audio.workaroundWebKitBug180748;
const workaroundWebKitBug180748 = typeof fullOptions.audio === 'object' && fullOptions.audio.workaroundWebKitBug180748;

const mediaStreamPromise = workaroundWebKitBug180748
? workaround180748(log, options.getUserMedia, mediaStreamConstraints)
: options.getUserMedia(mediaStreamConstraints);
try {
const mediaStream = await (workaroundWebKitBug180748
? workaround180748(log, fullOptions.getUserMedia, mediaStreamConstraints)
: fullOptions.getUserMedia(mediaStreamConstraints));

return mediaStreamPromise.then(mediaStream => {
const mediaStreamTracks = mediaStream.getAudioTracks().concat(mediaStream.getVideoTracks());
const mediaStreamTracks = [
...mediaStream.getAudioTracks(),
...mediaStream.getVideoTracks(),
];

log.info('Call to getUserMedia successful; got MediaStreamTracks:',
mediaStreamTracks);

return mediaStreamTracks.map(mediaStreamTrack => asLocalTrack(mediaStreamTrack, Object.assign(
extraLocalTrackOptions[mediaStreamTrack.kind], localTrackOptions)));
}, error => {
return mediaStreamTracks.map(mediaStreamTrack => asLocalTrack(mediaStreamTrack, {
...extraLocalTrackOptions[mediaStreamTrack.kind as 'audio' | 'video'],
...localTrackOptions,
}));
} catch (error) {
log.warn('Call to getUserMedia failed:', error);
throw error;
});
}
}

/**
Expand All @@ -185,5 +208,3 @@ function createLocalTracks(options) {
* get local video with <code>getUserMedia</code> when <code>tracks</code>
* are not provided.
*/

module.exports = createLocalTracks;
28 changes: 18 additions & 10 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';
import type { ConnectOptions, CreateLocalTrackOptions, CreateLocalTracksOptions, LocalTrack } from '../tsdef/types';
import type { ConnectOptions, CreateLocalTrackOptions } from '../tsdef/types';
import type { LocalAudioTrack as LocalAudioTrackType } from '../tsdef/LocalAudioTrack';
import type { LocalVideoTrack as LocalVideoTrackType } from '../tsdef/LocalVideoTrack';
import type { Log } from '../tsdef/loglevel';
import type { Room } from '../tsdef/Room';
import { createLocalTracks } from './createlocaltracks';
import { runPreflight } from './preflight/preflighttest';

const internals = {
connect: require('./connect'),
createLocalAudioTrack: require('./createlocaltrack').audio,
createLocalTracks: require('./createlocaltracks'),
createLocalVideoTrack: require('./createlocaltrack').video,
isSupported: require('./util/support')(),
version: require('../package.json').version,
Expand All @@ -20,19 +20,27 @@ const internals = {
};

function connect(token: string, options?: ConnectOptions): Promise<Room> {
return internals.connect(token, options);
const internalOptions = {
createLocalTracks,
...options
};
return internals.connect(token, internalOptions);
}

function createLocalAudioTrack(options?: CreateLocalTrackOptions): Promise<LocalAudioTrackType> {
return internals.createLocalAudioTrack(options);
}

function createLocalTracks(options?: CreateLocalTracksOptions): Promise<LocalTrack[]> {
return internals.createLocalTracks(options);
const internalOptions = {
createLocalTracks,
...options
};
return internals.createLocalAudioTrack(internalOptions);
}

function createLocalVideoTrack(options?: CreateLocalTrackOptions): Promise<LocalVideoTrackType> {
return internals.createLocalVideoTrack(options);
const internalOptions = {
createLocalTracks,
...options
};
return internals.createLocalVideoTrack(internalOptions);
}

/**
Expand Down Expand Up @@ -61,8 +69,8 @@ const LocalDataTrack = internals.LocalDataTrack;
module.exports = {
connect,
createLocalAudioTrack,
createLocalTracks,
createLocalVideoTrack,
createLocalTracks,
runPreflight,
isSupported,
version,
Expand Down
Loading

0 comments on commit 0f25497

Please sign in to comment.