@vonage/client-sdk-video 2.35.0-alpha.39 → 2.35.0-alpha.40

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.
@@ -461,7 +461,10 @@ declare namespace OT {
461
461
  stream?: Stream;
462
462
  session?: Session;
463
463
 
464
- destroy(): void;
464
+ destroy: {
465
+ (): Publisher;
466
+ promise: () => Promise<void>;
467
+ }
465
468
  getImgData(): string | null;
466
469
  getStats(callback?: (error?: OTError, stats?: PublisherStatsArr) => void): Promise<PublisherStatsArr>;
467
470
  getRtcStatsReport(): Promise<PublisherRtcStatsReportArr>;
@@ -486,7 +489,7 @@ declare namespace OT {
486
489
  getAudioSource(): MediaStreamTrack;
487
490
  setVideoSource(videoSourceId: string): Promise<undefined>;
488
491
  getVideoContentHint(): VideoContentHint;
489
- setVideoContentHint(hint: VideoContentHint): void;
492
+ setVideoContentHint(hint: VideoContentHint): Promise<void>;
490
493
  setTargetScalabilityMode(scalabilityMode: ScalabilityMode): void;
491
494
  getTargetScalabilityMode(): ScalabilityMode | undefined;
492
495
  getVideoSource(): {deviceId: string | null, type: string | null, track: MediaStreamTrack | null};
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.35.0 bf65e73
2
+ * @license OpenTok.js 2.35.0 4b5815904
3
3
  *
4
4
  * Copyright (c) 2010-2026 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, 29 May 2026 07:48:09 GMT
8
+ * Date: Fri, 29 May 2026 13:19:47 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -31880,7 +31880,7 @@ if (isWorker()) {
31880
31880
  initWorker();
31881
31881
  }
31882
31882
  var Module = (() => {
31883
- var _scriptDir = "file:///Users/ec2-user/actions-runner/webrtc-js/_work/webrtc-js/webrtc-js/node_modules/@vonage/js-sframe/dist/js-sframe.es.js";
31883
+ var _scriptDir = "file:///Users/ec2-user/Desktop/webrtc-js-runner/actions-runner/_work/webrtc-js/webrtc-js/node_modules/@vonage/js-sframe/dist/js-sframe.es.js";
31884
31884
  return function(Module2) {
31885
31885
  Module2 = Module2 || {};
31886
31886
  var Module2 = typeof Module2 != "undefined" ? Module2 : {};
@@ -40966,6 +40966,7 @@ function SessionDispatcher(session, _temp) {
40966
40966
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
40967
40967
 
40968
40968
  "use strict";
40969
+ /* provided dependency */ var Promise = __webpack_require__(86964);
40969
40970
 
40970
40971
 
40971
40972
  var _interopRequireDefault = __webpack_require__(95709);
@@ -40986,22 +40987,28 @@ const getVideoTrackForStream = mediaStream => {
40986
40987
  * @param {MediaStream} mediaStream
40987
40988
  * @param {String} contentHint, one of "", "motion", "detail" or "text"
40988
40989
  */
40989
- const setVideoContentHint = (mediaStream, contentHint) => {
40990
+ // eslint-disable-next-line consistent-return
40991
+ const setVideoContentHint = (mediaStream, contentHint) => new Promise((resolve, reject) => {
40992
+ const error = msg => {
40993
+ logging.warn(msg);
40994
+ reject(new Error(msg));
40995
+ };
40996
+ if (!(mediaStream != null && mediaStream.getVideoTracks)) {
40997
+ return error('Invalid media stream');
40998
+ }
40990
40999
  if (!isValidVideoContentHint(contentHint)) {
40991
- logging.warn('Invalid content hint. Valid content hints are "text", "detail", "motion", or ""');
40992
- return;
41000
+ return error('Invalid content hint. Valid content hints are "text", "detail", "motion", or ""');
40993
41001
  }
40994
41002
  const videoTrack = getVideoTrackForStream(mediaStream);
40995
41003
  if (!videoTrack) {
40996
- logging.warn('Tried to set contentHint but no video track is present');
40997
- return;
41004
+ return error('Tried to set contentHint but no video track is present');
40998
41005
  }
40999
41006
  if (videoTrack.contentHint === undefined) {
41000
- logging.warn('contentHint not supported by this browser');
41001
- return;
41007
+ return error('contentHint not supported by this browser');
41002
41008
  }
41003
41009
  videoTrack.contentHint = contentHint;
41004
- };
41010
+ resolve();
41011
+ });
41005
41012
 
41006
41013
  /**
41007
41014
  * Returns contentHint for videoTrack of MediaStream
@@ -41920,7 +41927,7 @@ function staticConfigFactory(_temp) {
41920
41927
  _ref$axios = _ref.axios,
41921
41928
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
41922
41929
  _ref$properties = _ref.properties,
41923
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"bf65e73","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","vonageApiURL":""} : _ref$properties;
41930
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"4b5815904","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","vonageApiURL":""} : _ref$properties;
41924
41931
  /** @type builtInConfig */
41925
41932
  const builtInConfig = (0, _cloneDeep.default)(properties);
41926
41933
  /**
@@ -44410,7 +44417,7 @@ function PublisherFactory(_ref) {
44410
44417
  logging.debug('OT.Publisher.onStreamAvailable');
44411
44418
  state.set('BindingMedia');
44412
44419
  if (_targetContentHint !== undefined) {
44413
- (0, _videoContentHint.setVideoContentHint)(webOTStream, _targetContentHint);
44420
+ (0, _videoContentHint.setVideoContentHint)(webOTStream, _targetContentHint).catch(() => {});
44414
44421
  }
44415
44422
  cleanupLocalStream();
44416
44423
  webRTCStream = webOTStream;
@@ -45148,7 +45155,7 @@ function PublisherFactory(_ref) {
45148
45155
  }
45149
45156
  streamCleanupJobs.releaseAll();
45150
45157
  streamReadyJobs.empty();
45151
- this.disconnect();
45158
+ const disconnectPromise = this.disconnect();
45152
45159
  microphone = null;
45153
45160
  cleanupLocalStream();
45154
45161
  webRTCStream = null;
@@ -45173,6 +45180,7 @@ function PublisherFactory(_ref) {
45173
45180
  if (!state.isDestroyed()) {
45174
45181
  state.set('NotPublishing');
45175
45182
  }
45183
+ return disconnectPromise;
45176
45184
  };
45177
45185
  const hasVideo = () => {
45178
45186
  if (!webRTCStream || webRTCStream.getVideoTracks().length === 0) {
@@ -46763,20 +46771,23 @@ function PublisherFactory(_ref) {
46763
46771
  *
46764
46772
  * @see <a href="#getVideoContentHint">Publisher.getVideoContentHint()</a>
46765
46773
  * @see <a href="OT.html#initPublisher">OT.initPublisher()</a>
46774
+ * @returns {Promise<void>}
46766
46775
  * @method #setVideoContentHint
46767
46776
  * @memberOf Publisher
46768
46777
  */
46769
46778
  this.setVideoContentHint = videoContentHint => {
46770
46779
  if (!(0, _videoContentHint.isValidVideoContentHint)(videoContentHint)) {
46771
- logging.warn('Invalid content hint. Valid content hints are "text", "detail", "motion", or ""');
46772
- return;
46780
+ const msg = 'Invalid content hint. Valid content hints are "text", "detail", "motion", or ""';
46781
+ logging.warn(msg);
46782
+ return Promise.reject(new Error(msg));
46773
46783
  }
46774
46784
  const changedStaticContent = isStaticContentHint() !== isStaticContentHint(videoContentHint);
46775
46785
  _targetContentHint = videoContentHint;
46776
- (0, _videoContentHint.setVideoContentHint)(webRTCStream, videoContentHint);
46786
+ const promises = [(0, _videoContentHint.setVideoContentHint)(webRTCStream, videoContentHint)];
46777
46787
  if (changedStaticContent || isScreenSharing && properties._setDefaultScalabilityMode) {
46778
- configureScalabilityMode().catch(() => {});
46788
+ promises.push(configureScalabilityMode().catch(() => {}));
46779
46789
  }
46790
+ return Promise.all(promises).then(() => undefined);
46780
46791
  };
46781
46792
 
46782
46793
  /**
@@ -46863,30 +46874,22 @@ function PublisherFactory(_ref) {
46863
46874
  * @memberOf Publisher
46864
46875
  */
46865
46876
  this.getTargetScalabilityMode = () => _targetScalabilityMode;
46866
-
46867
- /**
46868
- * Deletes the Publisher object and removes it from the HTML DOM.
46869
- * <p>
46870
- * The Publisher object dispatches a <code>destroyed</code> event when the DOM
46871
- * element is removed.
46872
- * </p>
46873
- * @method #destroy
46874
- * @memberOf Publisher
46875
- * @return {Publisher} The Publisher.
46876
- */
46877
-
46878
- this.destroy = function ( /* unused */reason, quiet) {
46877
+ const destroyWithCallback = function destroyWithCallback(reason, quiet, callback) {
46878
+ if (callback === void 0) {
46879
+ callback = () => {};
46880
+ }
46879
46881
  // @todo OPENTOK-36652 this.session should not be needed here
46880
- if (state.isAttemptingToPublish() && this.session) {
46882
+ if (state.isAttemptingToPublish() && _this.session) {
46881
46883
  logConnectivityEvent('Cancel', {
46882
46884
  reason: 'destroy'
46883
46885
  });
46884
46886
  }
46885
46887
  if (state.isDestroyed()) {
46886
- return this;
46888
+ callback();
46889
+ return _this;
46887
46890
  }
46888
46891
  state.set('Destroyed');
46889
- reset();
46892
+ reset().then(() => callback(), err => callback(err));
46890
46893
  amrState.destroy();
46891
46894
  if (processedOptions) {
46892
46895
  processedOptions.off();
@@ -46901,9 +46904,9 @@ function PublisherFactory(_ref) {
46901
46904
  privateEvents = null;
46902
46905
  }
46903
46906
  if (quiet !== true) {
46904
- this.dispatchEvent(new Events.DestroyedEvent(_eventNames.default.PUBLISHER_DESTROYED, this, reason));
46907
+ _this.dispatchEvent(new Events.DestroyedEvent(_eventNames.default.PUBLISHER_DESTROYED, _this, reason));
46905
46908
  }
46906
- this.off();
46909
+ _this.off();
46907
46910
  if (_videoMediaProcessorConnector) {
46908
46911
  _videoMediaProcessorConnector.destroy();
46909
46912
  _videoMediaProcessorConnector.stopOriginalTrack();
@@ -46915,22 +46918,57 @@ function PublisherFactory(_ref) {
46915
46918
  if (removeDeviceChangeListener !== undefined) {
46916
46919
  removeDeviceChangeListener();
46917
46920
  }
46918
- return this;
46921
+ return _this;
46922
+ };
46923
+
46924
+ /**
46925
+ * Deletes the Publisher object and removes it from the HTML DOM.
46926
+ * <p>
46927
+ * The Publisher object dispatches a <code>destroyed</code> event when the DOM
46928
+ * element is removed.
46929
+ * </p>
46930
+ * @method #destroy
46931
+ * @memberOf Publisher
46932
+ * @return {Publisher} The Publisher.
46933
+ */
46934
+ this.destroy = function ( /* unused */reason, quiet) {
46935
+ return destroyWithCallback(reason, quiet);
46919
46936
  };
46920
46937
 
46938
+ /**
46939
+ * Promise-based variant of {@link Publisher#destroy}.
46940
+ * Resolves with the Publisher instance once destruction is complete,
46941
+ * or rejects if an error occurs during teardown.
46942
+ *
46943
+ * @method #destroy.promise
46944
+ * @memberOf Publisher
46945
+ * @returns {Promise<Publisher>}
46946
+ */
46947
+ this.destroy.promise = (reason, quiet) => new Promise((resolve, reject) => {
46948
+ destroyWithCallback(reason, quiet, err => {
46949
+ if (err) {
46950
+ reject(err);
46951
+ } else {
46952
+ resolve();
46953
+ }
46954
+ });
46955
+ });
46956
+
46921
46957
  /*
46922
46958
  * @methodOf Publisher
46959
+ * @returns {Promise<Array<void>>}
46923
46960
  * @private
46924
46961
  */
46925
46962
  this.disconnect = () => {
46926
- Object.keys(peerConnectionsAsync).forEach(peerConnectionId => {
46963
+ const disconnections = Object.keys(peerConnectionsAsync).map(peerConnectionId => {
46927
46964
  const futurePeerConnection = getPeerConnectionById(peerConnectionId);
46928
46965
  delete peerConnectionsAsync[peerConnectionId];
46929
- futurePeerConnection.then(peerConnection => this._removePeerConnection(peerConnection));
46966
+ return futurePeerConnection.then(peerConnection => this._removePeerConnection(peerConnection));
46930
46967
  });
46931
46968
 
46932
46969
  // In case the publisher is reused we need to clear the streamchannels
46933
46970
  streamChannels.length = 0;
46971
+ return Promise.all(disconnections);
46934
46972
  };
46935
46973
  this.processMessage = (type, fromConnectionId, message) => {
46936
46974
  const subscriberId = (0, _get.default)(message, 'params.subscriber', fromConnectionId).replace(/^INVALID-STREAM$/, fromConnectionId);