Skip to content

Commit

Permalink
Merge pull request #1975 from twilio/prep-2.26.1
Browse files Browse the repository at this point in the history
Prep for 2.26.1
  • Loading branch information
manjeshbhargav committed Jan 31, 2023
2 parents 7885fd1 + cc99499 commit 41603af
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 35 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ 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.26.1 (January 31, 2023)
=========================

Bug Fixes
---------

- Fixed a bug that manifests on Chrome versions 112+ where `Room.getStats()` rejects the returned Promise due to a
TypeError caused by trying to read from the now-removed `RTCMediaStreamTrackStats`. Instead, the SDK now reads from
the `RTCMediaSourceStats`. (VIDEO-12411)
- Fixed an error in the type definition for the `attach()` method of `AudioTrack` and `VideoTrack`. (VIDEO-12242)
- Fixed an error in the type definition for `createLocalAudioTrack()`. (VIDEO-12383)

2.26.0 (December 14, 2022)
==========================

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.26.0/twilio-video.min.js"></script>
<script src="//sdk.twilio.com/js/video/releases/2.26.1/twilio-video.min.js"></script>
```

Using this method, twilio-video.js will set a browser global:
Expand Down
10 changes: 4 additions & 6 deletions lib/webrtc/getstats.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ function _getStats(peerConnection, options) {
[remoteVideoTracks, 'remoteVideoTrackStats', true]
], ([tracks, statsArrayName, isRemote]) => {
return tracks.map(track => {
return getTrackStats(peerConnection, track, Object.assign({
isRemote: isRemote
}, options)).then(trackStatsArray => {
return getTrackStats(peerConnection, track, Object.assign({ isRemote }, options)).then(trackStatsArray => {
trackStatsArray.forEach(trackStats => {
trackStats.trackId = track.id;
statsResponse[statsArrayName].push(trackStats);
Expand Down Expand Up @@ -470,7 +468,7 @@ function standardizeChromeOrSafariStats(response) {
}
});

const isRemote = track && track.remoteSource;
const isRemote = track ? track.remoteSource : !localMedia;
const mainSources = isRemote ? [inbound] : outbound;
const stats = [];
const remoteSource = isRemote ? remoteOutbound : remoteInbound; // remote rtp stats
Expand Down Expand Up @@ -523,7 +521,7 @@ function standardizeChromeOrSafariStats(response) {
standardizedStats.frameWidthReceived = frameWidth;
} else {
standardizedStats.frameWidthSent = frameWidth;
standardizedStats.frameWidthInput = track.frameWidth;
standardizedStats.frameWidthInput = track ? track.frameWidth : localMedia.width;
}
}

Expand All @@ -533,7 +531,7 @@ function standardizeChromeOrSafariStats(response) {
standardizedStats.frameHeightReceived = frameHeight;
} else {
standardizedStats.frameHeightSent = frameHeight;
standardizedStats.frameHeightInput = track.frameHeight;
standardizedStats.frameHeightInput = track ? track.frameHeight : localMedia.height;
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/integration/spec/webrtc/getstats.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ const sdpFormat = getSdpFormat();
assert(trackStats, `expected to have property: ${stats}.${trackType}[0]`);

[
{ key: 'frameWidthInput', type: 'number' },
{ key: 'frameHeightInput', type: 'number' },
{ key: 'frameWidthSent', type: 'number' },
{ key: 'frameHeightSent', type: 'number' },
{ key: 'ssrc', type: 'string' },
{ key: 'timestamp', type: 'number' },
{ key: 'bytesReceived', type: 'number' },
Expand Down
15 changes: 2 additions & 13 deletions tsdef/AudioTrack.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { Track } from './Track';
import { MediaTrack } from './MediaTrack';

export class AudioTrack extends Track {
isStarted: boolean;
isEnabled: boolean;
export class AudioTrack extends MediaTrack {
kind: 'audio';
mediaStreamTrack: MediaStreamTrack;

attach(element?: HTMLMediaElement | string): HTMLMediaElement;
detach(element?: HTMLMediaElement | string): HTMLMediaElement[];

on(event: 'disabled', listener: (track: this) => void): this;
on(event: 'enabled', listener: (track: this) => void): this;
on(event: 'started', listener: (track: this) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
16 changes: 16 additions & 0 deletions tsdef/MediaTrack.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Track } from './Track';

export class MediaTrack extends Track {
isStarted: boolean;
isEnabled: boolean;
mediaStreamTrack: MediaStreamTrack;

attach(element?: HTMLMediaElement | string): HTMLMediaElement;
detach(element: HTMLMediaElement | string): HTMLMediaElement;
detach(): HTMLMediaElement[];

on(event: 'disabled', listener: (track: this) => void): this;
on(event: 'enabled', listener: (track: this) => void): this;
on(event: 'started', listener: (track: this) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
14 changes: 2 additions & 12 deletions tsdef/VideoTrack.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Track } from './Track';
import { MediaTrack } from './MediaTrack';
import { VideoProcessor } from './VideoProcessor';

export namespace VideoTrack {
Expand All @@ -8,22 +8,12 @@ export namespace VideoTrack {
}
}

export class VideoTrack extends Track {
isStarted: boolean;
isEnabled: boolean;
export class VideoTrack extends MediaTrack {
dimensions: VideoTrack.Dimensions;
kind: 'video';
processor: VideoProcessor | null;
mediaStreamTrack: MediaStreamTrack;
processedTrack: MediaStreamTrack | null;

addProcessor(processor: VideoProcessor): this;
removeProcessor(processor: VideoProcessor): this;
attach(element?: HTMLMediaElement | string): HTMLVideoElement;
detach(element?: HTMLMediaElement | string): HTMLVideoElement[];

on(event: 'disabled', listener: (track: this) => void): this;
on(event: 'enabled', listener: (track: this) => void): this;
on(event: 'started', listener: (track: this) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
7 changes: 4 additions & 3 deletions tsdef/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const isSupported: boolean;
export const version:string;
export const Logger: Log.RootLogger;
export function connect(token: string, options?: ConnectOptions): CancelablePromise<Room>;
export function createLocalAudioTrack(options?: CreateLocalTracksOptions|CreateLocalAudioTrackOptions): Promise<LocalAudioTrack>;
export function createLocalAudioTrack(options?: CreateLocalTrackOptions|CreateLocalAudioTrackOptions): Promise<LocalAudioTrack>;
export function createLocalTracks(options?: CreateLocalTracksOptions): Promise<LocalTrack[]>;
export function createLocalVideoTrack(options?: CreateLocalTrackOptions): Promise<LocalVideoTrack>;
export function runPreflight(token: string, options?: PreflightOptions): PreflightTest;
Expand Down Expand Up @@ -43,6 +43,9 @@ export { Room } from './Room';
export { Track } from './Track';
export { TrackPublication } from './TrackPublication';
export { TwilioError } from './TwilioError';
export { VideoProcessor } from './VideoProcessor';
export { VideoTrack } from './VideoTrack';

export {
AudioCodec,
AudioCodecSettings,
Expand Down Expand Up @@ -93,5 +96,3 @@ export {
VideoTrackPublication,
VP8CodecSettings
} from './types';
export { VideoProcessor } from './VideoProcessor';
export { VideoTrack } from './VideoTrack';
3 changes: 3 additions & 0 deletions tsdef/twilio-video-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ function trackSubscribed(track: Video.VideoTrack | Video.AudioTrack) {
}

function trackUnsubscribed(track: Video.VideoTrack | Video.AudioTrack) {
const element = document.createElement(track.kind);
track.detach('#foo').remove();
track.detach(element).remove();
track.detach().forEach(element => element.remove());
}

Expand Down

0 comments on commit 41603af

Please sign in to comment.