@opentok/client 2.35.0-alpha.34 → 2.35.0-alpha.35

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.
@@ -27,7 +27,7 @@ declare namespace OT {
27
27
  };
28
28
 
29
29
  export function checkScreenSharingCapability(
30
- callback: (response: ScreenSharingCapabilityResponse) => void
30
+ callback?: (response: ScreenSharingCapabilityResponse) => void
31
31
  ): Promise<ScreenSharingCapabilityResponse>;
32
32
 
33
33
  export function checkSystemRequirements(): number;
@@ -66,7 +66,7 @@ declare namespace OT {
66
66
  export type VideoBitratePreset = VideoBitratePresetInput | 'custom';
67
67
 
68
68
  export function getDevices(
69
- callback: (error: OTError | undefined, devices?: Device[]) => void
69
+ callback?: (error: OTError | undefined, devices?: Device[]) => void
70
70
  ): Promise<Device[]>;
71
71
 
72
72
  export function getAudioOutputDevices(): Promise<AudioOutputDevice[]>;
@@ -463,7 +463,7 @@ declare namespace OT {
463
463
 
464
464
  destroy(): void;
465
465
  getImgData(): string | null;
466
- getStats(callback: (error?: OTError, stats?: PublisherStatsArr) => void): void;
466
+ getStats(callback?: (error?: OTError, stats?: PublisherStatsArr) => void): Promise<PublisherStatsArr>;
467
467
  getRtcStatsReport(): Promise<PublisherRtcStatsReportArr>;
468
468
  getStyle(): PublisherStyle;
469
469
  applyVideoFilter(videoFilter: VideoFilter): Promise<void>;
@@ -615,8 +615,8 @@ declare namespace OT {
615
615
  }
616
616
  disconnect(): Promise<void>;
617
617
  disableForceMute(): Promise<void>;
618
- forceDisconnect(connection: Connection, callback: (error?: OTError) => void): Promise<void>;
619
- forceUnpublish(stream: Stream, callback: (error?: OTError) => void): Promise<void>;
618
+ forceDisconnect(connection: Connection, callback?: (error?: OTError) => void): Promise<void>;
619
+ forceUnpublish(stream: Stream, callback?: (error?: OTError) => void): Promise<void>;
620
620
  forceMuteStream(stream: Stream): Promise<void>;
621
621
  forceMuteAll(excludedStreams?: Stream[]): Promise<void>;
622
622
  getPublisherForStream(stream: Stream): Publisher | undefined;
@@ -891,7 +891,7 @@ declare namespace OT {
891
891
  version: number
892
892
  ): void;
893
893
 
894
- export function reportIssue(callback: (error?: OTError, reportId?: string) => void): Promise<string>;
894
+ export function reportIssue(callback?: (error?: OTError, reportId?: string) => void): Promise<string>;
895
895
 
896
896
  export function setAudioOutputDevice(deviceId: string): Promise<void>;
897
897
 
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.35.0 0b971face
2
+ * @license OpenTok.js 2.35.0 7a8f447c8
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: Tue, 26 May 2026 08:44:19 GMT
8
+ * Date: Tue, 26 May 2026 14:08:09 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -41920,7 +41920,7 @@ function staticConfigFactory(_temp) {
41920
41920
  _ref$axios = _ref.axios,
41921
41921
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
41922
41922
  _ref$properties = _ref.properties,
41923
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"0b971face","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;
41923
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"7a8f447c8","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
41924
  /** @type builtInConfig */
41925
41925
  const builtInConfig = (0, _cloneDeep.default)(properties);
41926
41926
  /**
@@ -44009,7 +44009,7 @@ function PublisherFactory(_ref) {
44009
44009
  shouldAllowAudio = _processedOptions.shouldAllowAudio,
44010
44010
  properties = _processedOptions.properties,
44011
44011
  getUserMedia = _processedOptions.getUserMedia;
44012
-
44012
+ let _targetContentHint = (0, _videoContentHint.isValidVideoContentHint)(properties.videoContentHint) ? properties.videoContentHint : undefined;
44013
44013
  // start with undefined
44014
44014
  Object.defineProperty(this, 'loudness', {
44015
44015
  writable: false,
@@ -44072,6 +44072,7 @@ function PublisherFactory(_ref) {
44072
44072
 
44073
44073
  // / Private Methods
44074
44074
 
44075
+ const isStaticContentHint = contentHint => ['text', 'detail'].includes(contentHint != null ? contentHint : this.getVideoContentHint());
44075
44076
  const shouldSkipMuteEventsFromTrack = () => {
44076
44077
  // Screensharing in Chrome sometimes triggers 'mute' and 'unmute'
44077
44078
  // repeatedly for no reason OPENTOK-37818
@@ -44083,9 +44084,7 @@ function PublisherFactory(_ref) {
44083
44084
  // If videoContentHint suggests video could be static, i.e. text or detail
44084
44085
  // we will ignore the mute events coming from the video track.
44085
44086
  // Further info: OPENTOK-44289
44086
- const staticContentHints = ['text', 'detail'];
44087
- const isStaticContent = staticContentHints.includes(properties.videoContentHint);
44088
- return isCustomVideoTrack && isStaticContent;
44087
+ return isCustomVideoTrack && isStaticContentHint();
44089
44088
  };
44090
44089
  const logAnalyticsEvent = options.logAnalyticsEvent || ((action, variation, payload, logOptions, throttle) => {
44091
44090
  let stats = (0, _assign.default)({
@@ -44410,8 +44409,8 @@ function PublisherFactory(_ref) {
44410
44409
  case 0:
44411
44410
  logging.debug('OT.Publisher.onStreamAvailable');
44412
44411
  state.set('BindingMedia');
44413
- if (properties.videoContentHint !== undefined) {
44414
- (0, _videoContentHint.setVideoContentHint)(webOTStream, properties.videoContentHint);
44412
+ if (_targetContentHint !== undefined) {
44413
+ (0, _videoContentHint.setVideoContentHint)(webOTStream, _targetContentHint);
44415
44414
  }
44416
44415
  cleanupLocalStream();
44417
44416
  webRTCStream = webOTStream;
@@ -44946,7 +44945,7 @@ function PublisherFactory(_ref) {
44946
44945
  channels: properties.channels,
44947
44946
  capableSimulcastStreams,
44948
44947
  overrideSimulcastEnabled,
44949
- sessionSimulcastEnabled,
44948
+ sessionSimulcastEnabled: sourceStreamId === 'MANTIS' ? sessionSimulcastEnabled : false,
44950
44949
  enableRidSimulcast,
44951
44950
  logAnalyticsEvent: log,
44952
44951
  offerOverrides: {
@@ -45061,69 +45060,80 @@ function PublisherFactory(_ref) {
45061
45060
  const getTemporalOnlyScalabilityMode = scalabilityMode => `L1${scalabilityMode.slice(2)}`;
45062
45061
  const configureScalabilityMode = /*#__PURE__*/function () {
45063
45062
  var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
45064
- var scalabilityMode, codecsWhitelist, isCamera;
45063
+ var isStaticContent, scalabilityMode, codecsWhitelist, isCamera;
45065
45064
  return _regenerator.default.wrap(function _callee12$(_context12) {
45066
45065
  while (1) switch (_context12.prev = _context12.next) {
45067
45066
  case 0:
45067
+ isStaticContent = isStaticContentHint();
45068
45068
  if (!_targetScalabilityMode) {
45069
- _context12.next = 13;
45069
+ _context12.next = 19;
45070
45070
  break;
45071
45071
  }
45072
- _context12.prev = 1;
45072
+ _context12.prev = 2;
45073
45073
  logAnalyticsEvent('setScalabilityMode', 'Attempt', {
45074
45074
  scalabilityMode: _targetScalabilityMode
45075
45075
  });
45076
- _context12.next = 5;
45076
+ if (!isStaticContent) {
45077
+ _context12.next = 9;
45078
+ break;
45079
+ }
45080
+ _context12.next = 7;
45081
+ return _this._setScalabilityMode(getTemporalOnlyScalabilityMode(_targetScalabilityMode));
45082
+ case 7:
45083
+ _context12.next = 11;
45084
+ break;
45085
+ case 9:
45086
+ _context12.next = 11;
45077
45087
  return Promise.all([_this._setScalabilityMode(_targetScalabilityMode, TARGET_SCALABILITY_MODE_SVC_CODECS), _this._setScalabilityMode(getTemporalOnlyScalabilityMode(_targetScalabilityMode), TARGET_SCALABILITY_MODE_NON_SVC_CODECS)]);
45078
- case 5:
45088
+ case 11:
45079
45089
  logAnalyticsEvent('setScalabilityMode', 'Success', {
45080
45090
  scalabilityMode: _targetScalabilityMode
45081
45091
  });
45082
- _context12.next = 12;
45092
+ _context12.next = 18;
45083
45093
  break;
45084
- case 8:
45085
- _context12.prev = 8;
45086
- _context12.t0 = _context12["catch"](1);
45094
+ case 14:
45095
+ _context12.prev = 14;
45096
+ _context12.t0 = _context12["catch"](2);
45087
45097
  logging.error('OT.Publisher failed to apply scalability mode', _context12.t0);
45088
45098
  logAnalyticsEvent('setScalabilityMode', 'Failure', {
45089
45099
  message: _context12.t0.message
45090
45100
  });
45091
- case 12:
45101
+ case 18:
45092
45102
  return _context12.abrupt("return");
45093
- case 13:
45103
+ case 19:
45094
45104
  if (!(!properties.constraints.video || !sessionSimulcastEnabled || capableSimulcastStreams < 2)) {
45095
- _context12.next = 15;
45105
+ _context12.next = 21;
45096
45106
  break;
45097
45107
  }
45098
45108
  return _context12.abrupt("return");
45099
- case 15:
45109
+ case 21:
45100
45110
  codecsWhitelist = ['VP9'];
45101
45111
  isCamera = !isScreenSharing && !isCustomVideoTrack;
45102
45112
  if (isCamera) {
45103
- scalabilityMode = 'L3T3';
45113
+ scalabilityMode = isStaticContent ? 'L1T3' : 'L3T3';
45104
45114
  } else if (properties._setDefaultScalabilityMode && isScreenSharing) {
45105
45115
  // When using private API, and screenSharing, rely on content hint.
45106
45116
  scalabilityMode = (0, _getScalabilityModeFromContentHint.default)(_this.getVideoContentHint());
45107
45117
  }
45108
45118
  if (!scalabilityMode) {
45109
- _context12.next = 27;
45119
+ _context12.next = 33;
45110
45120
  break;
45111
45121
  }
45112
- _context12.prev = 19;
45113
- _context12.next = 22;
45122
+ _context12.prev = 25;
45123
+ _context12.next = 28;
45114
45124
  return _this._setScalabilityMode(scalabilityMode, codecsWhitelist);
45115
- case 22:
45116
- _context12.next = 27;
45125
+ case 28:
45126
+ _context12.next = 33;
45117
45127
  break;
45118
- case 24:
45119
- _context12.prev = 24;
45120
- _context12.t1 = _context12["catch"](19);
45128
+ case 30:
45129
+ _context12.prev = 30;
45130
+ _context12.t1 = _context12["catch"](25);
45121
45131
  logging.error('OT.Publisher failed to apply scalability mode', _context12.t1);
45122
- case 27:
45132
+ case 33:
45123
45133
  case "end":
45124
45134
  return _context12.stop();
45125
45135
  }
45126
- }, _callee12, null, [[1, 8], [19, 24]]);
45136
+ }, _callee12, null, [[2, 14], [25, 30]]);
45127
45137
  }));
45128
45138
  return function configureScalabilityMode() {
45129
45139
  return _ref21.apply(this, arguments);
@@ -45181,9 +45191,7 @@ function PublisherFactory(_ref) {
45181
45191
  // https://bugs.chromium.org/p/chromium/issues/detail?id=931033
45182
45192
  // We will ignore track.muted when screensharing and custom when videoContentHint
45183
45193
  // suggests video could be static, i.e. text or detail
45184
- const staticContentHints = ['text', 'detail'];
45185
- const isStaticContent = staticContentHints.includes(properties.videoContentHint);
45186
- const isStaticCustom = isCustomVideoTrack && isStaticContent;
45194
+ const isStaticCustom = isCustomVideoTrack && isStaticContentHint();
45187
45195
  const shouldIgnoreTrackMuteState = OTHelpers.env.isChromium && (isScreenSharing || isStaticCustom);
45188
45196
  return webRTCStream.getVideoTracks().reduce((isEnabled, track) => isEnabled && (!track.muted || !!shouldIgnoreTrackMuteState) && track.enabled && track.readyState !== 'ended', properties.publishVideo);
45189
45197
  };
@@ -46669,8 +46677,14 @@ function PublisherFactory(_ref) {
46669
46677
  * @memberOf Publisher
46670
46678
  */
46671
46679
  this.setVideoContentHint = videoContentHint => {
46680
+ if (!(0, _videoContentHint.isValidVideoContentHint)(videoContentHint)) {
46681
+ logging.warn('Invalid content hint. Valid content hints are "text", "detail", "motion", or ""');
46682
+ return;
46683
+ }
46684
+ const changedStaticContent = isStaticContentHint() !== isStaticContentHint(videoContentHint);
46685
+ _targetContentHint = videoContentHint;
46672
46686
  (0, _videoContentHint.setVideoContentHint)(webRTCStream, videoContentHint);
46673
- if (isScreenSharing && properties._setDefaultScalabilityMode) {
46687
+ if (changedStaticContent || isScreenSharing && properties._setDefaultScalabilityMode) {
46674
46688
  configureScalabilityMode();
46675
46689
  }
46676
46690
  };
@@ -46813,7 +46827,7 @@ function PublisherFactory(_ref) {
46813
46827
  const subscriberId = (0, _get.default)(message, 'params.subscriber', fromConnectionId).replace(/^INVALID-STREAM$/, fromConnectionId);
46814
46828
  const peerId = (0, _get.default)(message, 'content.peerId');
46815
46829
  const sourceStreamId = (0, _get.default)(message, 'content.sourceStreamId', 'MANTIS');
46816
- if (type === 'generateoffer') {
46830
+ if (type === 'generateoffer' && sourceStreamId === 'MANTIS') {
46817
46831
  const platformSimulcastEnabled = (0, _get.default)(message, 'content.simulcastEnabled', false);
46818
46832
  sessionSimulcastEnabled = overrideSimulcastEnabled != null ? overrideSimulcastEnabled : platformSimulcastEnabled;
46819
46833
  }
@@ -48682,17 +48696,32 @@ function PublisherFactory(_ref) {
48682
48696
  * @see <a href="Subscriber.html#getStats">Subscriber.getStats()</a>
48683
48697
  * @see <a href="#getRtcStatsReport">Publisher.getRtcStatsReport()</a>
48684
48698
  *
48699
+ * @return {Promise}
48700
+ *
48685
48701
  * @method #getStats
48686
48702
  * @memberOf Publisher
48687
48703
  */
48688
48704
  this.getStats = function getStats(callback) {
48705
+ if (callback === void 0) {
48706
+ callback = () => {};
48707
+ }
48689
48708
  notifyGetStatsCalled();
48690
- _getStats(_statsSources.default.SDK, (err, stats) => {
48691
- if (err) {
48692
- callback(err);
48693
- } else {
48694
- callback(null, stats);
48695
- }
48709
+ return new Promise((resolve, reject) => {
48710
+ _getStats(_statsSources.default.SDK, (err, stats) => {
48711
+ if (err) {
48712
+ // eslint-disable-next-line no-empty
48713
+ try {
48714
+ callback(err);
48715
+ } catch (_) {}
48716
+ reject(err);
48717
+ } else {
48718
+ // eslint-disable-next-line no-empty
48719
+ try {
48720
+ callback(null, stats);
48721
+ } catch (_) {}
48722
+ resolve(stats);
48723
+ }
48724
+ });
48696
48725
  });
48697
48726
  };
48698
48727