@opentok/client 2.36.0-alpha.19 → 2.36.0-alpha.20

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.
@@ -400,7 +400,10 @@ declare namespace OT {
400
400
 
401
401
  export class Publisher extends OTEventEmitter<{
402
402
  accessAllowed: Event<'accessAllowed', Publisher>;
403
- accessDenied: Event<'accessDenied', Publisher>;
403
+ accessDenied: Event<'accessDenied', Publisher> & {
404
+ requestedSources: Array<'camera' | 'microphone' | 'screenshare'>;
405
+ deniedSources?: Array<'camera' | 'microphone'>;
406
+ };
404
407
  accessDialogClosed: Event<'accessDialogClosed', Publisher>;
405
408
  accessDialogOpened: Event<'accessDialogOpened', Publisher>;
406
409
 
@@ -945,4 +948,4 @@ declare namespace OT {
945
948
 
946
949
  declare module "@opentok/client" {
947
950
  export = OT;
948
- }
951
+ }
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.36.0 3d5d68ecf
2
+ * @license OpenTok.js 2.36.0 ef075bd96
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: Wed, 05 Aug 2026 09:03:24 GMT
8
+ * Date: Fri, 07 Aug 2026 07:43:41 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -260,12 +260,184 @@ module.exports = Function.prototype.bind || implementation;
260
260
 
261
261
  var _interopRequireDefault = __webpack_require__(95709);
262
262
  exports.__esModule = true;
263
- exports["default"] = void 0;
263
+ exports.queryPermissionState = exports.getRequestedSources = exports.getDeniedSources = exports["default"] = exports.createAccessDeniedEvent = void 0;
264
+ var _regenerator = _interopRequireDefault(__webpack_require__(92207));
265
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(79092));
264
266
  var _eventNames = _interopRequireDefault(__webpack_require__(78255));
265
267
  var _exception_codes = _interopRequireDefault(__webpack_require__(90529));
266
268
  var _events = _interopRequireDefault(__webpack_require__(78436));
267
269
  const Events = (0, _events.default)();
268
- var _default = (device, step) => new Events.ExceptionEvent(_eventNames.default.ACCESS_DENIED, `${device} permission denied ${step}`, 'accessDenied', _exception_codes.default.UNABLE_TO_PUBLISH);
270
+ const MEDIA_SOURCES = ['camera', 'microphone'];
271
+ const queryPermissionState = /*#__PURE__*/function () {
272
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, navigatorPermissions) {
273
+ var _yield$navigatorPermi, permissionState;
274
+ return _regenerator.default.wrap(function _callee$(_context) {
275
+ while (1) switch (_context.prev = _context.next) {
276
+ case 0:
277
+ if (navigatorPermissions === void 0) {
278
+ navigatorPermissions = typeof window !== 'undefined' ? window.navigator.permissions : undefined;
279
+ }
280
+ if (!(navigatorPermissions === undefined || typeof navigatorPermissions.query !== 'function')) {
281
+ _context.next = 3;
282
+ break;
283
+ }
284
+ return _context.abrupt("return", undefined);
285
+ case 3:
286
+ _context.prev = 3;
287
+ _context.next = 6;
288
+ return navigatorPermissions.query({
289
+ name
290
+ });
291
+ case 6:
292
+ _yield$navigatorPermi = _context.sent;
293
+ permissionState = _yield$navigatorPermi.state;
294
+ return _context.abrupt("return", permissionState);
295
+ case 11:
296
+ _context.prev = 11;
297
+ _context.t0 = _context["catch"](3);
298
+ return _context.abrupt("return", undefined);
299
+ case 14:
300
+ case "end":
301
+ return _context.stop();
302
+ }
303
+ }, _callee, null, [[3, 11]]);
304
+ }));
305
+ return function queryPermissionState(_x, _x2) {
306
+ return _ref.apply(this, arguments);
307
+ };
308
+ }();
309
+ exports.queryPermissionState = queryPermissionState;
310
+ const getRequestedSources = function getRequestedSources(constraints) {
311
+ if (constraints === void 0) {
312
+ constraints = {};
313
+ }
314
+ const requestedSources = [];
315
+ if (constraints.video) {
316
+ requestedSources.push('camera');
317
+ }
318
+ if (constraints.audio) {
319
+ requestedSources.push('microphone');
320
+ }
321
+ if (constraints.screen) {
322
+ requestedSources.push('screenshare');
323
+ }
324
+ return requestedSources;
325
+ };
326
+ exports.getRequestedSources = getRequestedSources;
327
+ const getDeniedSources = /*#__PURE__*/function () {
328
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(constraints) {
329
+ var deniedSources;
330
+ return _regenerator.default.wrap(function _callee2$(_context2) {
331
+ while (1) switch (_context2.prev = _context2.next) {
332
+ case 0:
333
+ if (constraints === void 0) {
334
+ constraints = {};
335
+ }
336
+ deniedSources = [];
337
+ _context2.t0 = constraints.video;
338
+ if (!_context2.t0) {
339
+ _context2.next = 8;
340
+ break;
341
+ }
342
+ _context2.next = 6;
343
+ return queryPermissionState('camera');
344
+ case 6:
345
+ _context2.t1 = _context2.sent;
346
+ _context2.t0 = _context2.t1 === 'denied';
347
+ case 8:
348
+ if (!_context2.t0) {
349
+ _context2.next = 10;
350
+ break;
351
+ }
352
+ deniedSources.push('camera');
353
+ case 10:
354
+ _context2.t2 = constraints.audio;
355
+ if (!_context2.t2) {
356
+ _context2.next = 16;
357
+ break;
358
+ }
359
+ _context2.next = 14;
360
+ return queryPermissionState('microphone');
361
+ case 14:
362
+ _context2.t3 = _context2.sent;
363
+ _context2.t2 = _context2.t3 === 'denied';
364
+ case 16:
365
+ if (!_context2.t2) {
366
+ _context2.next = 18;
367
+ break;
368
+ }
369
+ deniedSources.push('microphone');
370
+ case 18:
371
+ return _context2.abrupt("return", deniedSources.length > 0 ? deniedSources : undefined);
372
+ case 19:
373
+ case "end":
374
+ return _context2.stop();
375
+ }
376
+ }, _callee2);
377
+ }));
378
+ return function getDeniedSources(_x3) {
379
+ return _ref2.apply(this, arguments);
380
+ };
381
+ }();
382
+ exports.getDeniedSources = getDeniedSources;
383
+ const normalizeDeniedSources = (device, deniedSources) => {
384
+ if (Array.isArray(deniedSources)) {
385
+ const validDeniedSources = deniedSources.filter(source => MEDIA_SOURCES.includes(source));
386
+ return validDeniedSources.length > 0 ? validDeniedSources : undefined;
387
+ }
388
+ if (MEDIA_SOURCES.includes(device)) {
389
+ return [device];
390
+ }
391
+ return undefined;
392
+ };
393
+ const accessDeniedEvent = function accessDeniedEvent(device, step, constraints, deniedSources) {
394
+ if (deniedSources === void 0) {
395
+ deniedSources = {};
396
+ }
397
+ const accessDenied = new Events.ExceptionEvent(_eventNames.default.ACCESS_DENIED, `${device} permission denied ${step}`, 'accessDenied', _exception_codes.default.UNABLE_TO_PUBLISH);
398
+ const requestedSources = getRequestedSources(constraints);
399
+ if (!requestedSources || requestedSources.length === 0) {
400
+ accessDenied.requestedSources = [device];
401
+ } else {
402
+ accessDenied.requestedSources = requestedSources;
403
+ }
404
+ const normalizedDeniedSources = normalizeDeniedSources(device, deniedSources);
405
+ if (normalizedDeniedSources) {
406
+ accessDenied.deniedSources = normalizedDeniedSources;
407
+ }
408
+ return accessDenied;
409
+ };
410
+ const createAccessDeniedEvent = /*#__PURE__*/function () {
411
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(device, step, constraints) {
412
+ var deniedSources;
413
+ return _regenerator.default.wrap(function _callee3$(_context3) {
414
+ while (1) switch (_context3.prev = _context3.next) {
415
+ case 0:
416
+ if (constraints === void 0) {
417
+ constraints = {};
418
+ }
419
+ _context3.prev = 1;
420
+ _context3.next = 4;
421
+ return getDeniedSources(constraints);
422
+ case 4:
423
+ deniedSources = _context3.sent;
424
+ return _context3.abrupt("return", accessDeniedEvent(device, step, constraints, deniedSources));
425
+ case 8:
426
+ _context3.prev = 8;
427
+ _context3.t0 = _context3["catch"](1);
428
+ return _context3.abrupt("return", accessDeniedEvent(device, step, constraints));
429
+ case 11:
430
+ case "end":
431
+ return _context3.stop();
432
+ }
433
+ }, _callee3, null, [[1, 8]]);
434
+ }));
435
+ return function createAccessDeniedEvent(_x4, _x5, _x6) {
436
+ return _ref3.apply(this, arguments);
437
+ };
438
+ }();
439
+ exports.createAccessDeniedEvent = createAccessDeniedEvent;
440
+ var _default = accessDeniedEvent;
269
441
  exports["default"] = _default;
270
442
 
271
443
  /***/ }),
@@ -10174,7 +10346,7 @@ const nodeListToArray = function nodeListToArray(nodes) {
10174
10346
  };
10175
10347
  const selectorToElementArray = function selectorToElementArray(selector, context) {
10176
10348
  let elements;
10177
- if (typeof selector === 'undefined') {
10349
+ if (selector === undefined) {
10178
10350
  return [];
10179
10351
  }
10180
10352
  if (typeof selector === 'string') {
@@ -39878,7 +40050,7 @@ function staticConfigFactory(_temp) {
39878
40050
  _ref$axios = _ref.axios,
39879
40051
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
39880
40052
  _ref$properties = _ref.properties,
39881
- properties = _ref$properties === void 0 ? {"version":"v2.36.0","buildHash":"3d5d68ecf","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;
40053
+ properties = _ref$properties === void 0 ? {"version":"v2.36.0","buildHash":"ef075bd96","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;
39882
40054
  /** @type builtInConfig */
39883
40055
  const builtInConfig = (0, _cloneDeep.default)(properties);
39884
40056
  /**
@@ -41523,7 +41695,7 @@ var _setScalabilityMode = _interopRequireDefault(__webpack_require__(15783));
41523
41695
  var _proxyUrl = __webpack_require__(31772);
41524
41696
  var _createPublishVideoPromiseHandlers = _interopRequireDefault(__webpack_require__(58224));
41525
41697
  var _permissionListener = _interopRequireDefault(__webpack_require__(49471));
41526
- var _accessDeniedEvent = _interopRequireDefault(__webpack_require__(752));
41698
+ var _accessDeniedEvent = __webpack_require__(752);
41527
41699
  var _getSpatialResolution = _interopRequireDefault(__webpack_require__(39841));
41528
41700
  var _VideoBitratePreset = _interopRequireDefault(__webpack_require__(51831));
41529
41701
  var _videoConstraints = _interopRequireDefault(__webpack_require__(49474));
@@ -41919,7 +42091,11 @@ function PublisherFactory(_ref) {
41919
42091
  // The user has clicked the 'deny' button in the allow access dialog, or it's
41920
42092
  // set to always deny, or the access was denied due to HTTP restrictions;
41921
42093
  const onAccessDenied = errorParam => {
42094
+ var _processedOptions, _processedOptions$pro;
41922
42095
  const error = (0, _cloneDeep.default)(errorParam);
42096
+ const constraints = isScreenSharing ? {
42097
+ screen: true
42098
+ } : ((_processedOptions = processedOptions) == null ? void 0 : (_processedOptions$pro = _processedOptions.properties) == null ? void 0 : _processedOptions$pro.constraints) || {};
41923
42099
  let isIframe;
41924
42100
  try {
41925
42101
  isIframe = window.self !== window.top;
@@ -41956,7 +42132,9 @@ function PublisherFactory(_ref) {
41956
42132
  reason: 'AccessDenied'
41957
42133
  });
41958
42134
  this.trigger('publishComplete', error);
41959
- this.dispatchEvent((0, _accessDeniedEvent.default)('device', 'while initializing'));
42135
+ (0, _accessDeniedEvent.createAccessDeniedEvent)('device', 'while initializing', constraints).then(errorEvent => {
42136
+ this.dispatchEvent(errorEvent);
42137
+ });
41960
42138
  };
41961
42139
  const userMediaError = error => {
41962
42140
  // See OPENTOK-48099 for more context. In certain instances, this passed-in parameter can be malformed.
@@ -41992,13 +42170,13 @@ function PublisherFactory(_ref) {
41992
42170
  accessDialogOpened: onAccessDialogOpened,
41993
42171
  accessDialogClosed: onAccessDialogClosed
41994
42172
  });
41995
- const _processedOptions = processedOptions,
41996
- isScreenSharing = _processedOptions.isScreenSharing,
41997
- isCustomAudioTrack = _processedOptions.isCustomAudioTrack,
41998
- isCustomVideoTrack = _processedOptions.isCustomVideoTrack,
41999
- shouldAllowAudio = _processedOptions.shouldAllowAudio,
42000
- properties = _processedOptions.properties,
42001
- getUserMedia = _processedOptions.getUserMedia;
42173
+ const _processedOptions2 = processedOptions,
42174
+ isScreenSharing = _processedOptions2.isScreenSharing,
42175
+ isCustomAudioTrack = _processedOptions2.isCustomAudioTrack,
42176
+ isCustomVideoTrack = _processedOptions2.isCustomVideoTrack,
42177
+ shouldAllowAudio = _processedOptions2.shouldAllowAudio,
42178
+ properties = _processedOptions2.properties,
42179
+ getUserMedia = _processedOptions2.getUserMedia;
42002
42180
  let _targetContentHint = (0, _videoContentHint.isValidVideoContentHint)(properties.videoContentHint) ? properties.videoContentHint : undefined;
42003
42181
  // start with undefined
42004
42182
  Object.defineProperty(this, 'loudness', {
@@ -43813,9 +43991,12 @@ function PublisherFactory(_ref) {
43813
43991
  if (hasAudioVideoDevices) {
43814
43992
  (0, _permissionListener.default)().then(listener => {
43815
43993
  listener.on('accessDenied', device => {
43994
+ var _processedOptions3, _processedOptions3$pr;
43816
43995
  _this.accessAllowed = false;
43817
- const errorEvent = (0, _accessDeniedEvent.default)(device, 'during the call');
43818
- _this.dispatchEvent(errorEvent);
43996
+ const constraints = ((_processedOptions3 = processedOptions) == null ? void 0 : (_processedOptions3$pr = _processedOptions3.properties) == null ? void 0 : _processedOptions3$pr.constraints) || {};
43997
+ (0, _accessDeniedEvent.createAccessDeniedEvent)(device, 'during the call', constraints).then(errorEvent => {
43998
+ _this.dispatchEvent(errorEvent);
43999
+ });
43819
44000
  });
43820
44001
  });
43821
44002
  }
@@ -45436,7 +45617,7 @@ function PublisherFactory(_ref) {
45436
45617
  const getTrackFromDeviceId = /*#__PURE__*/function () {
45437
45618
  var _ref50 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(deviceId) {
45438
45619
  var _newVideoStream;
45439
- var oldTrackDeviceId, newOptions, _processedOptions2, getUserMediaHelper, newVideoStream, _newVideoStream$getVi, track;
45620
+ var oldTrackDeviceId, newOptions, _processedOptions4, getUserMediaHelper, newVideoStream, _newVideoStream$getVi, track;
45440
45621
  return _regenerator.default.wrap(function _callee37$(_context37) {
45441
45622
  while (1) switch (_context37.prev = _context37.next) {
45442
45623
  case 0:
@@ -45450,7 +45631,7 @@ function PublisherFactory(_ref) {
45450
45631
  accessDialogOpened: onAccessDialogOpened,
45451
45632
  accessDialogClosed: onAccessDialogClosed
45452
45633
  });
45453
- _processedOptions2 = processedOptions, getUserMediaHelper = _processedOptions2.getUserMedia;
45634
+ _processedOptions4 = processedOptions, getUserMediaHelper = _processedOptions4.getUserMedia;
45454
45635
  _context37.prev = 8;
45455
45636
  _context37.next = 11;
45456
45637
  return getUserMediaHelper();
@@ -45780,7 +45961,7 @@ function PublisherFactory(_ref) {
45780
45961
  const isMediaStreamTrack = track => track instanceof MediaStreamTrack || track && typeof track === 'object' && Object.getPrototypeOf(track).toString().includes('MediaStreamTrack');
45781
45962
  const setAudioSource = /*#__PURE__*/function () {
45782
45963
  var _ref56 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(audioSource) {
45783
- var currentCancelSentinel, setStreamIfNotCancelled, prevAudioSource, newTrack, newOptions, prevLabel, prevDeviceId, _processedOptions3, getUserMediaHelper, prevOptions, previousDevice, stream;
45964
+ var currentCancelSentinel, setStreamIfNotCancelled, prevAudioSource, newTrack, newOptions, prevLabel, prevDeviceId, _processedOptions5, getUserMediaHelper, prevOptions, previousDevice, stream;
45784
45965
  return _regenerator.default.wrap(function _callee44$(_context44) {
45785
45966
  while (1) switch (_context44.prev = _context44.next) {
45786
45967
  case 0:
@@ -45873,7 +46054,7 @@ function PublisherFactory(_ref) {
45873
46054
  if (prevAudioSource) {
45874
46055
  prevAudioSource.stop();
45875
46056
  }
45876
- _processedOptions3 = processedOptions, getUserMediaHelper = _processedOptions3.getUserMedia;
46057
+ _processedOptions5 = processedOptions, getUserMediaHelper = _processedOptions5.getUserMedia;
45877
46058
  _context44.prev = 37;
45878
46059
  _context44.t1 = setStreamIfNotCancelled;
45879
46060
  _context44.next = 41;
@@ -48701,6 +48882,8 @@ function PublisherFactory(_ref) {
48701
48882
  * app from having access to the camera and microphone.
48702
48883
  * <p>
48703
48884
  * This event is also dispatched if the user removes the permissions after previously granting them.
48885
+ * When available, the event includes a <code>deniedSources</code> array listing
48886
+ * <code>"camera"</code> and/or <code>"microphone"</code>.
48704
48887
  * <p>
48705
48888
  * <i>Note:</i> On macOS 10.15+ (Catalina), to publish a screen-sharing stream
48706
48889
  * the user must grant the browser access to the screen in macOS System Preferences &gt;
@@ -111154,7 +111337,7 @@ const getSupportedCodecs = /*#__PURE__*/function () {
111154
111337
  return _regenerator.default.wrap(function _callee$(_context) {
111155
111338
  while (1) switch (_context.prev = _context.next) {
111156
111339
  case 0:
111157
- if (!(typeof window === 'undefined')) {
111340
+ if (!(window === undefined)) {
111158
111341
  _context.next = 2;
111159
111342
  break;
111160
111343
  }
@@ -111300,7 +111483,7 @@ var _eventing = _interopRequireDefault(__webpack_require__(12607));
111300
111483
  var _isPageHideSupported = _interopRequireDefault(__webpack_require__(3124));
111301
111484
  function isDomReady() {
111302
111485
  // if there is no document, how is the document object model ready?
111303
- return typeof document === 'undefined' || document.readyState === 'complete' || document.readyState === 'interactive' && document.body;
111486
+ return document === undefined || document.readyState === 'complete' || document.readyState === 'interactive' && document.body;
111304
111487
  }
111305
111488
  let unloaded = false;
111306
111489
  const domStateFactory = function domStateFactory(deps) {