twilio-video 2.30.0 → 2.31.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/.release.json CHANGED
@@ -18,6 +18,7 @@
18
18
  "git rm -rf --ignore-unmatch dist es5",
19
19
  "npm run build:quick",
20
20
  "git add package.json",
21
+ "git add package-lock.json",
21
22
  "git add -f dist es5",
22
23
  "git commit -m \"${RELEASE_VERSION}\"",
23
24
  "git tag ${RELEASE_VERSION}",
@@ -32,6 +33,7 @@
32
33
  "git rm -rf dist es5",
33
34
  "npm run clean",
34
35
  "git add package.json",
36
+ "git add package-lock.json",
35
37
  "git commit -m \"${DEVELOPMENT_VERSION}\"",
36
38
  "git push origin ${BRANCH}"
37
39
  ]
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@ 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.31.0 (April 21, 2025)
6
+ =======================
7
+
8
+ New Features
9
+ ------------
10
+
11
+ ### Document Picture-in-Picture API Support
12
+
13
+ Previously, when `Client Track Switch Off Control` was set to `auto`, video tracks were automatically switched off—even if they were visible and rendered in a [Document Picture-in-Picture](https://developer.chrome.com/docs/web-platform/document-picture-in-picture) (PiP) window. This caused issues where users could see the video element, but the track itself was disabled. In this new SDK version, video tracks will remain active and continue to play when displayed in a PiP window.
14
+
5
15
  2.30.0 (March 28, 2025)
6
16
  ========================
7
17
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  twilio-video.js
2
2
  ===============
3
3
 
4
- [![NPM](https://img.shields.io/npm/v/twilio-video.svg)](https://www.npmjs.com/package/twilio-video) [![CircleCI](https://circleci.com/gh/twilio/twilio-video.js/tree/master.svg?style=svg&circle-token=80e91c8284c21ff16d3003702e17b903c0b32f1d)](https://circleci.com/gh/twilio/twilio-video.js/tree/master)
4
+ [![NPM](https://img.shields.io/npm/v/twilio-video.svg)](https://www.npmjs.com/package/twilio-video) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/twilio/twilio-video.js/tree/master.svg?style=shield&circle-token=CCIPRJ_7qmZwk292pKYnNqeFyi5x8_a409cfa25489fb617be3c56119e8064cc77ffb80)](https://circleci.com/gh/twilio/twilio-video.js/tree/master)
5
5
 
6
6
  twilio-video.js allows you to add real-time voice and video to your web apps.
7
7
 
@@ -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.30.0/twilio-video.min.js"></script>
77
+ <script src="//sdk.twilio.com/js/video/releases/2.31.0/twilio-video.min.js"></script>
78
78
  ```
79
79
 
80
80
  Using this method, twilio-video.js will set a browser global:
@@ -1,4 +1,4 @@
1
- /*! twilio-video.js 2.30.0
1
+ /*! twilio-video.js 2.31.0
2
2
 
3
3
  The following license applies to all parts of this software except as
4
4
  documented below.
@@ -6619,14 +6619,16 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
6619
6619
  };
6620
6620
  return RemoteVideoTrack;
6621
6621
  }(RemoteMediaVideoTrack));
6622
- function setupDocumentVisibilityTurnOff(removeVideoTrack) {
6623
- function onVisibilityChanged() {
6624
- maybeUpdateEnabledHint(removeVideoTrack);
6622
+ function isAttachedToDocumentPip(remoteVideoTrack) {
6623
+ if (!('documentPictureInPicture' in globalThis)) {
6624
+ return false;
6625
6625
  }
6626
- documentVisibilityMonitor.onVisibilityChange(1, onVisibilityChanged);
6627
- return function () {
6628
- documentVisibilityMonitor.offVisibilityChange(1, onVisibilityChanged);
6629
- };
6626
+ var pipWindow = globalThis.documentPictureInPicture.window;
6627
+ if (!pipWindow) {
6628
+ return false;
6629
+ }
6630
+ var pipEls = new WeakSet(pipWindow.document.querySelectorAll('video'));
6631
+ return remoteVideoTrack._getAllAttachedElements().some(function (el) { return pipEls.has(el); });
6630
6632
  }
6631
6633
  function maybeUpdateEnabledHint(remoteVideoTrack) {
6632
6634
  if (remoteVideoTrack._clientTrackSwitchOffControl !== 'auto') {
@@ -6635,7 +6637,9 @@ function maybeUpdateEnabledHint(remoteVideoTrack) {
6635
6637
  var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });
6636
6638
  var pipWindows = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return remoteVideoTrack._elToPipWindows.has(el); });
6637
6639
  // even when document is invisible we may have track playing in pip window.
6638
- var enabled = pipWindows.length > 0 || (document.visibilityState === 'visible' && visibleElements.length > 0);
6640
+ var enabled = pipWindows.length > 0 ||
6641
+ isAttachedToDocumentPip(remoteVideoTrack) ||
6642
+ (document.visibilityState === 'visible' && visibleElements.length > 0);
6639
6643
  if (enabled === true) {
6640
6644
  remoteVideoTrack._turnOffTimer.clear();
6641
6645
  remoteVideoTrack._setRenderHint({ enabled: true });
@@ -6663,6 +6667,15 @@ function maybeUpdateDimensionHint(remoteVideoTrack) {
6663
6667
  remoteVideoTrack._setRenderHint({ renderDimensions: renderDimensions });
6664
6668
  }
6665
6669
  }
6670
+ function setupDocumentVisibilityTurnOff(removeVideoTrack) {
6671
+ function onVisibilityChanged() {
6672
+ maybeUpdateEnabledHint(removeVideoTrack);
6673
+ }
6674
+ documentVisibilityMonitor.onVisibilityChange(1, onVisibilityChanged);
6675
+ return function () {
6676
+ documentVisibilityMonitor.offVisibilityChange(1, onVisibilityChanged);
6677
+ };
6678
+ }
6666
6679
  /**
6667
6680
  * @typedef {object} VideoContentPreferences
6668
6681
  * @property {VideoTrack.Dimensions} [renderDimensions] - Render Dimensions to request for the {@link RemoteVideoTrack}.
@@ -30838,7 +30851,7 @@ module.exports={
30838
30851
  "name": "twilio-video",
30839
30852
  "title": "Twilio Video",
30840
30853
  "description": "Twilio Video JavaScript Library",
30841
- "version": "2.30.0",
30854
+ "version": "2.31.0",
30842
30855
  "homepage": "https://twilio.com",
30843
30856
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
30844
30857
  "contributors": [