twilio-video 2.18.0 → 2.19.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/COMMON_ISSUES.md +108 -1
  3. package/LICENSE.md +1 -1
  4. package/README.md +1 -1
  5. package/dist/twilio-video.js +975 -436
  6. package/dist/twilio-video.min.js +23 -22
  7. package/es5/connect.js +37 -5
  8. package/es5/connect.js.map +1 -1
  9. package/es5/encodingparameters.js +5 -1
  10. package/es5/encodingparameters.js.map +1 -1
  11. package/es5/localparticipant.js +4 -0
  12. package/es5/localparticipant.js.map +1 -1
  13. package/es5/media/track/localmediatrack.js +2 -0
  14. package/es5/media/track/localmediatrack.js.map +1 -1
  15. package/es5/media/track/remotevideotrack.js +68 -14
  16. package/es5/media/track/remotevideotrack.js.map +1 -1
  17. package/es5/media/track/sender.js +50 -2
  18. package/es5/media/track/sender.js.map +1 -1
  19. package/es5/preflight/getCombinedConnectionStats.js +0 -1
  20. package/es5/preflight/getCombinedConnectionStats.js.map +1 -1
  21. package/es5/preflight/getturncredentials.js +2 -16
  22. package/es5/preflight/getturncredentials.js.map +1 -1
  23. package/es5/preflight/makestat.js +1 -1
  24. package/es5/preflight/makestat.js.map +1 -1
  25. package/es5/preflight/preflighttest.js +83 -11
  26. package/es5/preflight/preflighttest.js.map +1 -1
  27. package/es5/signaling/v2/cancelableroomsignalingpromise.js +4 -9
  28. package/es5/signaling/v2/cancelableroomsignalingpromise.js.map +1 -1
  29. package/es5/signaling/v2/localparticipant.js +35 -1
  30. package/es5/signaling/v2/localparticipant.js.map +1 -1
  31. package/es5/signaling/v2/mediasignaling.js +2 -4
  32. package/es5/signaling/v2/mediasignaling.js.map +1 -1
  33. package/es5/signaling/v2/peerconnection.js +228 -48
  34. package/es5/signaling/v2/peerconnection.js.map +1 -1
  35. package/es5/signaling/v2/peerconnectionmanager.js +8 -0
  36. package/es5/signaling/v2/peerconnectionmanager.js.map +1 -1
  37. package/es5/signaling/v2/publisherhintsignaling.js +85 -0
  38. package/es5/signaling/v2/publisherhintsignaling.js.map +1 -0
  39. package/es5/signaling/v2/renderhintssignaling.js +28 -17
  40. package/es5/signaling/v2/renderhintssignaling.js.map +1 -1
  41. package/es5/signaling/v2/room.js +33 -1
  42. package/es5/signaling/v2/room.js.map +1 -1
  43. package/es5/signaling/v2/twilioconnectiontransport.js +7 -28
  44. package/es5/signaling/v2/twilioconnectiontransport.js.map +1 -1
  45. package/es5/util/cancelablepromise.js +11 -0
  46. package/es5/util/cancelablepromise.js.map +1 -1
  47. package/es5/util/constants.js +3 -0
  48. package/es5/util/constants.js.map +1 -1
  49. package/es5/util/eventobserver.js +9 -19
  50. package/es5/util/eventobserver.js.map +1 -1
  51. package/es5/util/index.js +24 -6
  52. package/es5/util/index.js.map +1 -1
  53. package/es5/util/sdp/index.js +7 -3
  54. package/es5/util/sdp/index.js.map +1 -1
  55. package/es5/util/sdp/simulcast.js.map +1 -1
  56. package/es5/util/sid.js +18 -0
  57. package/es5/util/sid.js.map +1 -0
  58. package/lib/connect.js +50 -5
  59. package/lib/encodingparameters.js +5 -1
  60. package/lib/localparticipant.js +5 -0
  61. package/lib/media/track/localmediatrack.js +2 -0
  62. package/lib/media/track/remotevideotrack.js +74 -14
  63. package/lib/media/track/sender.js +36 -2
  64. package/lib/preflight/getCombinedConnectionStats.ts +0 -1
  65. package/lib/preflight/getturncredentials.ts +2 -12
  66. package/lib/preflight/makestat.ts +2 -2
  67. package/lib/preflight/preflighttest.ts +107 -13
  68. package/lib/signaling/v2/cancelableroomsignalingpromise.js +3 -12
  69. package/lib/signaling/v2/localparticipant.js +41 -1
  70. package/lib/signaling/v2/mediasignaling.js +2 -5
  71. package/lib/signaling/v2/peerconnection.js +227 -50
  72. package/lib/signaling/v2/peerconnectionmanager.js +9 -0
  73. package/lib/signaling/v2/publisherhintsignaling.js +71 -0
  74. package/lib/signaling/v2/renderhintssignaling.js +28 -17
  75. package/lib/signaling/v2/room.js +37 -1
  76. package/lib/signaling/v2/twilioconnectiontransport.js +5 -31
  77. package/lib/util/cancelablepromise.js +12 -0
  78. package/lib/util/constants.js +3 -0
  79. package/lib/util/eventobserver.js +10 -22
  80. package/lib/util/index.js +24 -6
  81. package/lib/util/sdp/index.js +6 -3
  82. package/lib/util/sdp/simulcast.js +0 -1
  83. package/lib/util/sid.js +20 -0
  84. package/package.json +5 -4
  85. package/tsconfig.json +1 -1
  86. package/tsdef/PreflightTypes.d.ts +1 -2
  87. package/tsdef/index.d.ts +2 -2
  88. package/tsdef/twilio-video-tests.ts +19 -0
  89. package/tsdef/types.d.ts +5 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,72 @@ 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.19.0 (January 31, 2022)
6
+ =========================
7
+
8
+ New Features
9
+ ------------
10
+
11
+ - This release introduces a new feature **Adaptive Simulcast**. This opt-in feature can be enabled by setting `preferredVideoCodecs="auto"` in ConnectOptions. When joining a group room with this feature enabled, the SDK will use VP8 simulcast, and will enable/disable simulcast layers dynamically, thus improving bandwidth and CPU usage for the publishing client. It works best when used along with `Client Track Switch Off Control` and `Video Content Preferences`. These two flags allow the SFU to determine which simulcast layers are needed, thus allowing it to disable the layers not needed on publisher side. This feature cannot be used alongside `maxVideoBitrate`.
12
+
13
+ If your application is currently using VP8 simulcast we recommend that you switch to this option.
14
+
15
+ Example:
16
+
17
+ ```ts
18
+ const { connect } = require('twilio-video');
19
+
20
+ const room = await connect(token, {
21
+ preferredVideoCodecs: 'auto',
22
+ bandwidthProfile: {
23
+ video: {
24
+ contentPreferencesMode: 'auto',
25
+ clientTrackSwitchOffControl: 'auto'
26
+ }
27
+ }
28
+ });
29
+ ```
30
+
31
+ Known Limitations
32
+ -----------------
33
+
34
+ - Specifying `preferredVideoCodecs="auto"` will revert to unicast in the following cases:
35
+ - The publisher is using Firefox.
36
+ - The publisher has preferred the H264 codec.
37
+ - The Room is configured to support only the H264 codec.
38
+ - Peer-to-Peer Rooms
39
+ - When the participant is being recorded, the SFU will not disable any simulcast layers of the participant's VideoTrack.
40
+
41
+ Bug Fixes
42
+ ---------
43
+
44
+ - Fixed a bug where `clientTrackSwitchOffControl` and `contentPreferencesMode` sometimes did not work as expected during network glitches. (VIDEO-7654)
45
+
46
+ 2.18.3 (January 4, 2022)
47
+ ========================
48
+
49
+ Bug Fixes
50
+ ---------
51
+
52
+ - Fixed a bug where connect was returning a Promise type instead of a CancelablePromise. (VIDEO-7831)
53
+ - Fixed a bug where `audioLevel`, `frameRate`, and `captureDimensions` WebRTC stats are returning null on certain browsers. With this release, these stats are now populated whenever they are available. (VIDEO-3600)
54
+
55
+ 2.18.2 (December 15, 2021)
56
+ ==========================
57
+
58
+ Bug Fixes
59
+ ---------
60
+
61
+ - Fixed a bug where setting `clientTrackSwitchOffControl` to `auto` caused the RemoteVideoTracks to get switched off while playing in picture-in-picture mode. Note that this fix does not apply to Firefox as it does not yet implement [picture-in-picture](https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API) APIs. (VIDEO-6677)
62
+
63
+ 2.18.1 (October 29, 2021)
64
+ =========================
65
+
66
+ Changes
67
+ -------
68
+
69
+ - Added some metrics to track the usage of the **Preflight API Public Beta** (`runPreflight`). There are no changes to the public APIs in this release. (VIDEO-6891)
70
+
5
71
  2.18.0 (October 13, 2021)
6
72
  =========================
7
73
 
package/COMMON_ISSUES.md CHANGED
@@ -36,6 +36,13 @@ before opening a new issue. We recommend regularly upgrading to the latest versi
36
36
 
37
37
  ### Chrome mobile
38
38
  <details>
39
+ <summary>Android 12: Video distortion on Chrome when hardware acceleration is enabled</summary>
40
+ <p>
41
+
42
+ This is a VP8 encoder issue on Android 12. Please see this [github ticket](https://github.com/twilio/twilio-video.js/issues/1627) and this [Chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1237677) for more details.
43
+ </p>
44
+ </details>
45
+ <details>
39
46
  <summary>Android Chrome on Pixel 3 receives corrupted video frames with codec VP8</summary>
40
47
  <p>
41
48
 
@@ -54,6 +61,13 @@ before opening a new issue. We recommend regularly upgrading to the latest versi
54
61
 
55
62
  ### Safari desktop
56
63
  <details>
64
+ <summary>Browser crashes when muting a VideoTrack that is using an H264 codec on Safari 15.1</summary>
65
+ <p>
66
+
67
+ Due to a regression on Safari 15.1, the browser crashes when a VideoTrack is muted that is using an H264 codec. Please use VP8 as a workaround for now. See more details [here](https://github.com/twilio/twilio-video.js/issues/1611).
68
+ </p>
69
+ </details>
70
+ <details>
57
71
  <summary>Failures to publish tracks on Safari 15</summary>
58
72
  <p>
59
73
 
@@ -99,14 +113,107 @@ before opening a new issue. We recommend regularly upgrading to the latest versi
99
113
 
100
114
  ### Safari mobile
101
115
  <details>
116
+ <summary>iOS 15: VideoTracks goes black and the page freezes on certain interruptions</summary>
117
+ <p>
118
+
119
+ Certain interruptions such as incoming calls, backgrounding the browser or switching between apps causes VideoTracks on Chrome and Safari on iOS 15.1 to go black. Sometimes, the whole page also freezes and become unresponsive causing audio and video to cut off. These issues are regressions on iOS 15.1. See the following bugs for more details.
120
+
121
+ * [Page freezing](https://bugs.webkit.org/show_bug.cgi?id=230922#c12)
122
+ * [VideoTrack going black](https://bugs.webkit.org/show_bug.cgi?id=232599)
123
+
124
+ A workaround can be implemented to prevent the VideoTrack from going black. This workaround however doesn't prevent the issue where sometimes the page freezes. It is recommended to apply this workaround on Chrome and Safari on iOS 15.1.
125
+
126
+ ```js
127
+ // Keeps track of video elements and their event listeners
128
+ const videoElements = {};
129
+
130
+ // Listen to onPlay and onPause events and intelligently re-attach the video element
131
+ function shimVideoElement(track, el) {
132
+ let wasInterrupted = false;
133
+
134
+ const onPause = () => {
135
+ wasInterrupted = true;
136
+ };
137
+
138
+ const onPlay = () => {
139
+ if (wasInterrupted) {
140
+ track.detach(el);
141
+ track.attach(el);
142
+ wasInterrupted = false;
143
+ }
144
+ };
145
+
146
+ el.addEventListener('pause', onPause);
147
+ el.addEventListener('play', onPlay);
148
+
149
+ // Track this element so we can remove the listeners
150
+ videoElements[el] = { onPause, onPlay };
151
+ }
152
+ ```
153
+
154
+ Apply the workaround after attaching the video element.
155
+
156
+ ```js
157
+ videoTrack.attach(videoElement);
158
+ shimVideoElement(videoTrack, videoElement);
159
+ ```
160
+
161
+ Remove the listeners before detaching the video element.
162
+
163
+ ```js
164
+ const { onPause, onPlay } = videoElements[videoElement];
165
+ videoElement.removeEventListener('pause', onPause);
166
+ videoElement.removeEventListener('play', onPlay);
167
+ ```
168
+ </p>
169
+ </details>
170
+ <details>
171
+ <summary>iOS 15: Browser crashes when publishing or muting a VideoTrack that is using an H264 codec</summary>
172
+ <p>
173
+
174
+ Chrome and Safari on iOS 15.1 crashes when a VideoTrack is muted or published using an H264 codec. This issue happens due to a regression on iOS 15.1. Please use VP8 as a workaround for now. See more details [here](https://github.com/twilio/twilio-video.js/issues/1611).
175
+ </p>
176
+ </details>
177
+ <details>
102
178
  <summary>iOS 15: Low audio volume in Safari</summary>
103
179
  <p>
104
- Safari on iOS version 15, sometimes routes audio to the earpiece and not the speakers by default. Which customers some time perceive as low audio volume. Find more details [here](https://github.com/twilio/twilio-video.js/issues/1586) and in this [WebKit bug](https://bugs.webkit.org/show_bug.cgi?id=230902).
180
+
181
+ Safari on iOS version 15, sometimes routes audio to the earpiece and not the speakers by default. Which customers some time perceive as low audio volume. Find more details [here](https://github.com/twilio/twilio-video.js/issues/1586) and in this [WebKit bug](https://bugs.webkit.org/show_bug.cgi?id=230902). As a workaround, you can pipe all remote audio tracks into a single audio context for iOS 15. Using a gain node, you can increase the gain value to increase the audio volume levels. See example below.
182
+
183
+ ```js
184
+ // Make sure to reuse the audioContext object as browsers
185
+ // have limits to the number of AudioContext instances you can create.
186
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
187
+
188
+ function attachAudioTrack(remoteAudioTrack) {
189
+ const audioNode = audioContext.createMediaStreamSource(new MediaStream([remoteAudioTrack.mediaStreamTrack]));
190
+ const gainNode = audioContext.createGain();
191
+
192
+ // Adjust this value depending on your customers' preference
193
+ gainNode.gain.value = 20;
194
+
195
+ audioNode.connect(gainNode);
196
+ gainNode.connect(audioContext.destination);
197
+ }
198
+
199
+ // Attach the RemoteAudioTrack once received.
200
+ attachAudioTrack(remoteAudioTrack);
201
+ ```
202
+
203
+ This workaround has the following potential side effects.
204
+
205
+ * There is a possibility of the introduction of echo. Please adjust the gain value and check for echo while testing the workaround.
206
+ * The output volume might end up really high if the user switches headsets.
207
+ * The default volume might end up really high once Apple rolls out the fix for this issue.
208
+
209
+ Keeping the side effects in mind, you might need to adjust your UI to improve the experience. For example, you can turn off this workaround by default and have a "call to action" in your UI that allows the user to turn the volume up if they cannot hear any audio. This button will then apply the workaround. Another option is to listen for `devicechange` events to determine if the user switches headsets. When this happens, you will have the ability to reset the gain value.
210
+
105
211
  </p>
106
212
  </details>
107
213
  <details>
108
214
  <summary>iOS 15: Audio is lost in a video call after an interruption with a phone call</summary>
109
215
  <p>
216
+
110
217
  Due to a regression on Safari on iOS 15, an incoming call causes local and sometimes remote media playback to stop. You can find more details in this [WebKit bug](https://bugs.webkit.org/show_bug.cgi?id=230537).
111
218
  </p>
112
219
  </details>
package/LICENSE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  The following license applies to all parts of this software except as
2
2
  documented below.
3
3
 
4
- Copyright (C) 2019-2021 Twilio, inc.
4
+ Copyright (C) 2019-2022 Twilio, inc.
5
5
  All rights reserved.
6
6
 
7
7
  Redistribution and use in source and binary forms, with or without
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 &lt;script&gt; tag.
75
75
 
76
76
  ```html
77
- <script src="//sdk.twilio.com/js/video/releases/2.18.0/twilio-video.min.js"></script>
77
+ <script src="//sdk.twilio.com/js/video/releases/2.19.0/twilio-video.min.js"></script>
78
78
 
79
79
  ```
80
80