twilio-video 2.25.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -1
- package/README.md +1 -1
- package/dist/twilio-video.js +1481 -1134
- package/dist/twilio-video.min.js +21 -21
- package/es5/media/track/localaudiotrack.js +28 -7
- package/es5/media/track/localaudiotrack.js.map +1 -1
- package/es5/media/track/localmediatrack.js +29 -0
- package/es5/media/track/localmediatrack.js.map +1 -1
- package/es5/media/track/localvideotrack.js +31 -10
- package/es5/media/track/localvideotrack.js.map +1 -1
- package/es5/media/track/sender.js +39 -1
- package/es5/media/track/sender.js.map +1 -1
- package/es5/room.js +50 -1
- package/es5/room.js.map +1 -1
- package/es5/transceiver.js +3 -3
- package/es5/transceiver.js.map +1 -1
- package/es5/webrtc/getstats.js +75 -58
- package/es5/webrtc/getstats.js.map +1 -1
- package/es5/webrtc/getusermedia.js +1 -1
- package/es5/webrtc/getusermedia.js.map +1 -1
- package/es5/webrtc/index.js.map +1 -1
- package/es5/webrtc/rtcpeerconnection/chrome.js +339 -286
- package/es5/webrtc/rtcpeerconnection/chrome.js.map +1 -1
- package/es5/webrtc/rtcpeerconnection/firefox.js +225 -179
- package/es5/webrtc/rtcpeerconnection/firefox.js.map +1 -1
- package/es5/webrtc/rtcpeerconnection/index.js.map +1 -1
- package/es5/webrtc/rtcpeerconnection/safari.js +276 -236
- package/es5/webrtc/rtcpeerconnection/safari.js.map +1 -1
- package/es5/webrtc/rtcrtpsender.js +12 -9
- package/es5/webrtc/rtcrtpsender.js.map +1 -1
- package/es5/webrtc/rtcsessiondescription/chrome.js +29 -22
- package/es5/webrtc/rtcsessiondescription/chrome.js.map +1 -1
- package/es5/webrtc/rtcsessiondescription/index.js.map +1 -1
- package/es5/webrtc/util/index.js +32 -15
- package/es5/webrtc/util/index.js.map +1 -1
- package/es5/webrtc/util/latch.js +83 -82
- package/es5/webrtc/util/latch.js.map +1 -1
- package/es5/webrtc/util/sdp.js +12 -19
- package/es5/webrtc/util/sdp.js.map +1 -1
- package/lib/media/track/localaudiotrack.js +30 -8
- package/lib/media/track/localmediatrack.js +29 -0
- package/lib/media/track/localvideotrack.js +33 -10
- package/lib/media/track/sender.js +42 -1
- package/lib/room.js +41 -1
- package/lib/transceiver.js +3 -3
- package/lib/webrtc/getstats.js +155 -171
- package/lib/webrtc/getusermedia.js +1 -2
- package/lib/webrtc/index.js +1 -1
- package/lib/webrtc/rtcpeerconnection/chrome.js +284 -316
- package/lib/webrtc/rtcpeerconnection/firefox.js +173 -197
- package/lib/webrtc/rtcpeerconnection/index.js +1 -1
- package/lib/webrtc/rtcpeerconnection/safari.js +228 -256
- package/lib/webrtc/rtcrtpsender.js +10 -8
- package/lib/webrtc/rtcsessiondescription/chrome.js +24 -24
- package/lib/webrtc/rtcsessiondescription/index.js +1 -1
- package/lib/webrtc/util/index.js +26 -33
- package/lib/webrtc/util/latch.js +78 -83
- package/lib/webrtc/util/sdp.js +32 -41
- package/package.json +2 -2
- package/tsdef/LocalAudioTrack.d.ts +3 -0
- package/tsdef/LocalVideoTrack.d.ts +3 -0
- package/tsdef/Room.d.ts +1 -0
- package/es5/webrtc/util/eventtarget.js +0 -34
- package/es5/webrtc/util/eventtarget.js.map +0 -1
- package/lib/webrtc/util/eventtarget.js +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,117 @@ The Twilio Programmable Video SDKs use [Semantic Versioning](http://www.semver.o
|
|
|
2
2
|
|
|
3
3
|
**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.
|
|
4
4
|
|
|
5
|
+
2.26.0 (December 14, 2022)
|
|
6
|
+
==========================
|
|
7
|
+
|
|
8
|
+
New Features
|
|
9
|
+
------------
|
|
10
|
+
|
|
11
|
+
- The [`LocalAudioTrack`](https://sdk.twilio.com/js/video/releases/2.26.0/docs/LocalAudioTrack.html) and
|
|
12
|
+
[`LocalVideoTrack`](https://sdk.twilio.com/js/video/releases/2.26.0/docs/LocalVideoTrack.html) classes now provide a
|
|
13
|
+
new boolean property called `isMuted`, which lets you know if the audio or video source is currently providing raw media
|
|
14
|
+
samples. The classes also emit `muted` and `unmuted` events if the value of `isMuted` toggles. The application can use
|
|
15
|
+
these APIs to detect temporary loss of microphone or camera to other applications (ex: an incoming phone call on an iOS device),
|
|
16
|
+
and update the user interface accordingly. (VIDEO-11360)
|
|
17
|
+
|
|
18
|
+
- The `Room` class provides a new method called [refreshInactiveMedia](https://sdk.twilio.com/js/video/releases/2.26.0/docs/Room.html#refreshInactiveMedia),
|
|
19
|
+
which restarts any muted local media Tracks, and plays any inadvertently paused HTMLMediaElements that are attached to
|
|
20
|
+
local and remote media Tracks. This is useful especially on iOS devices, where sometimes your application's media may
|
|
21
|
+
not recover after an incoming phone call. You can use this method in conjunction with the local media Track's `isMuted`
|
|
22
|
+
property described previously to recover local and remote media after an incoming phone call as shown below. (VIDEO-11360)
|
|
23
|
+
|
|
24
|
+
### Vanilla JS
|
|
25
|
+
|
|
26
|
+
#### html
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<button id="refresh-inactive-media" disabled>Refresh Inactive Media</button>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### js
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
const { connect } = require('twilio-video');
|
|
36
|
+
|
|
37
|
+
const room = await connect('token', { name: 'my-cool-room' });
|
|
38
|
+
|
|
39
|
+
const $refreshInactiveMedia = document.getElementById('refresh-inactive-media');
|
|
40
|
+
$refreshInactiveMedia.onclick = () => room.refreshInactiveMedia();
|
|
41
|
+
|
|
42
|
+
const [{ track: localAudioTrack }] = [...room.localParticipant.audioTracks.values()];
|
|
43
|
+
const [{ track: localVideoTrack }] = [...room.localParticipant.videoTracks.values()];
|
|
44
|
+
|
|
45
|
+
const isLocalAudioOrVideoMuted = () => {
|
|
46
|
+
return localAudioTrack.isMuted || localVideoTrack.isMuted;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const onLocalMediaMutedChanged = () => {
|
|
50
|
+
$refreshInactiveMedia.disabled = !isLocalAudioOrVideoMuted();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
[localAudioTrack, localVideoTrack].forEach(localMediaTrack => {
|
|
54
|
+
['muted', 'unmuted'].forEach(event => {
|
|
55
|
+
localMediaTrack.on(event, onLocalMediaMutedChanged);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### React
|
|
61
|
+
|
|
62
|
+
#### src/hooks/useLocalMediaMuted.js
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { useEffect, useState } from 'react';
|
|
66
|
+
|
|
67
|
+
export default function useLocalMediaMuted(localMediaTrack) {
|
|
68
|
+
const [isMuted, setIsMuted] = useState(localMediaTrack?.isMuted ?? false);
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const updateMuted = () => setIsMuted(localMediaTrack?.isMuted ?? false);
|
|
72
|
+
updateMuted();
|
|
73
|
+
|
|
74
|
+
localMediaTrack?.on('muted', updateMuted);
|
|
75
|
+
localMediaTrack?.on('unmuted', updateMuted);
|
|
76
|
+
|
|
77
|
+
return () => {
|
|
78
|
+
localMediaTrack?.off('muted', updateMuted);
|
|
79
|
+
localMediaTrack?.off('unmuted', updateMuted);
|
|
80
|
+
};
|
|
81
|
+
}, [localMediaTrack]);
|
|
82
|
+
|
|
83
|
+
return isMuted;
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### src/components/room.js
|
|
88
|
+
|
|
89
|
+
```jsx
|
|
90
|
+
import useLocalMediaMuted from '../hooks/useLocalMediaMuted';
|
|
91
|
+
|
|
92
|
+
export default function Room({ room }) {
|
|
93
|
+
const [{ track: localAudioTrack }] = [...room.localParticipant.audioTracks.values()];
|
|
94
|
+
const [{ track: localVideoTrack }] = [...room.localParticipant.videoTracks.values()];
|
|
95
|
+
|
|
96
|
+
const isLocalAudioMuted = useLocalMediaMuted(localAudioTrack);
|
|
97
|
+
const isLocalVideoMuted = useLocalMediaMuted(localVideoTrack);
|
|
98
|
+
const isLocalMediaMuted = isLocalAudioMuted || isLocalVideoMuted;
|
|
99
|
+
|
|
100
|
+
const refreshInactiveMedia = () => {
|
|
101
|
+
room.refreshInactiveMedia();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<>
|
|
106
|
+
...
|
|
107
|
+
{isLocalMediaMuted && <Button onClick={refreshInactiveMedia}>
|
|
108
|
+
Refresh Inactive Media
|
|
109
|
+
</Button>}
|
|
110
|
+
...
|
|
111
|
+
</>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
5
116
|
2.25.0 (November 14, 2022)
|
|
6
117
|
==========================
|
|
7
118
|
|
|
@@ -27,7 +138,7 @@ The application can decide to capture audio from a specific audio input device b
|
|
|
27
138
|
|
|
28
139
|
- using the MediaTrackConstraints `{ audio: { deviceId: 'foo' } }`, and "foo" is available, or
|
|
29
140
|
- using the MediaTrackConstraints `{ audio: { deviceId: { ideal: 'foo' } } }` and "foo" is available, or
|
|
30
|
-
- using the MediaTrackConstraints `{ audio: { deviceId: { exact: 'foo' } } }` and "foo" is available
|
|
141
|
+
- using the MediaTrackConstraints `{ audio: { deviceId: { exact: 'foo' } } }` and "foo" is available
|
|
31
142
|
|
|
32
143
|
In this case, the LocalAudioTrack DOES NOT switch to another audio input device if the current audio input device is no
|
|
33
144
|
longer available. See below for the behavior of this property based on how the LocalAudioTrack is created. (VIDEO-11701)
|
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Releases of twilio-video.js are hosted on a CDN, and you can include these
|
|
|
74
74
|
directly in your web app using a <script> tag.
|
|
75
75
|
|
|
76
76
|
```html
|
|
77
|
-
<script src="//sdk.twilio.com/js/video/releases/2.
|
|
77
|
+
<script src="//sdk.twilio.com/js/video/releases/2.26.0/twilio-video.min.js"></script>
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
Using this method, twilio-video.js will set a browser global:
|