@opentok/client 2.31.0-alpha.8 → 2.31.0-alpha.9

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.31.0 66dcaa538
2
+ * @license OpenTok.js 2.31.0 f525c1fca
3
3
  *
4
4
  * Copyright (c) 2010-2025 TokBox, Inc.
5
5
  * Subject to the applicable Software Development Kit (SDK) License Agreement:
6
6
  * https://www.vonage.com/legal/communications-apis/terms-of-use/
7
7
  *
8
- * Date: Fri, 18 Jul 2025 14:09:01 GMT
8
+ * Date: Fri, 18 Jul 2025 16:16:22 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8682,7 +8682,7 @@ const logging = (0, _log.default)('StaticConfig');
8682
8682
  */
8683
8683
 
8684
8684
  /** @type builtInConfig */
8685
- const builtInConfig = (0, _cloneDeep.default)({"version":"v2.31.0","buildHash":"66dcaa538","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
8685
+ const builtInConfig = (0, _cloneDeep.default)({"version":"v2.31.0","buildHash":"f525c1fca","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
8686
8686
  const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
8687
8687
  const liveConfigMap = {
8688
8688
  apiUrl: 'apiURL',
@@ -73616,33 +73616,45 @@ function waitForVideoToBePlaying(_ref) {
73616
73616
  const videoElementFacade = deps.videoElementFacade || defaultVideoElementFacade;
73617
73617
  const isVideoFrameBlack = deps.isVideoFrameBlack || _isVideoFrameBlack.default;
73618
73618
  const videoElementFacadeEvents = deps.videoElementFacadeEvents || (0, _eventHelper.default)(videoElementFacade);
73619
+ let timeoutReturnValue = false;
73620
+ let requestCallbackId;
73619
73621
  const promise = new Promise(resolve => {
73620
73622
  // eslint-disable-next-line consistent-return
73621
73623
  const onVideoPlaybackHandler = videoPlaybackEvent => {
73624
+ // When the video is playing, we resolve with the event at timeout.
73625
+ timeoutReturnValue = videoPlaybackEvent;
73626
+
73627
+ // Clean up event listeners - we only needed to listen until the first playback event
73628
+ videoElementFacadeEvents.removeAll();
73622
73629
  if (!isBufferedStream || !env.isChromium) {
73623
73630
  // If there is no video and we're not subscribed to video, or if we're using a non-Chromium browser,
73624
73631
  // resolve immediately because the video frame callback will never be called or because the bug is not present on non-Chromium browsers.
73625
73632
  return resolve(videoPlaybackEvent);
73626
73633
  }
73627
- const videoFrameCallback = (_, metadata) => {
73634
+ const videoFrameCallback = () => {
73628
73635
  // During an AMR transition or any new stream bind, we check that a real video frame is displayed for Chromium browsers
73629
73636
  // before switching streams to eliminate the screen flicker. See VIDCS-3570.
73630
73637
  const hasBlackVideoFrame = isVideoFrameBlack(videoElementFacade);
73631
- const hasMaxWaitTimeElapsed = metadata.mediaTime > maxWaitTime / 1000 - 1;
73632
- if (!hasBlackVideoFrame || hasMaxWaitTimeElapsed) {
73633
- // If we have a real video frame, or if we've waited 4s (maybe a webcam cover is down), we proceed.
73638
+ if (!hasBlackVideoFrame) {
73639
+ // If we have a real video frame, we proceed.
73634
73640
  return resolve(videoPlaybackEvent);
73635
73641
  }
73636
73642
 
73637
73643
  // If we haven't seen a non-black video frame, we re-register the callback.
73638
- return videoElementFacade.requestVideoFrameCallback(videoFrameCallback);
73644
+ requestCallbackId = videoElementFacade.requestVideoFrameCallback(videoFrameCallback);
73645
+ return requestCallbackId;
73639
73646
  };
73640
- videoElementFacade.requestVideoFrameCallback(videoFrameCallback);
73647
+ requestCallbackId = videoElementFacade.requestVideoFrameCallback(videoFrameCallback);
73641
73648
  };
73642
73649
  videoElementFacadeEvents.on('timeupdate', onVideoPlaybackHandler);
73643
73650
  videoElementFacadeEvents.on('loadedmetadata', onVideoPlaybackHandler);
73644
73651
  });
73645
- return (0, _promiseFinally.default)((0, _pTimeout.default)(promise, maxWaitTime, () => false), () => videoElementFacadeEvents.removeAll());
73652
+ return (0, _promiseFinally.default)((0, _pTimeout.default)(promise, maxWaitTime, () => timeoutReturnValue), () => {
73653
+ videoElementFacadeEvents.removeAll();
73654
+ if (requestCallbackId) {
73655
+ videoElementFacade.cancelVideoFrameCallback(requestCallbackId);
73656
+ }
73657
+ });
73646
73658
  }
73647
73659
  var _default = waitForVideoToBePlaying;
73648
73660
  exports.default = _default;