@opentok/client 2.35.0-alpha.26 → 2.35.0-alpha.28
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/dist/js/opentok.d.ts +8 -5
- package/dist/js/opentok.js +310 -185
- package/dist/js/opentok.js.map +1 -1
- package/dist/js/opentok.min.js +4 -4
- package/dist/js/opentok.min.js.map +1 -1
- package/package.json +1 -1
package/dist/js/opentok.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license OpenTok.js 2.35.0
|
|
2
|
+
* @license OpenTok.js 2.35.0 6d82efef1
|
|
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:
|
|
8
|
+
* Date: Sat, 23 May 2026 07:05:36 GMT
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -26176,7 +26176,9 @@ function SubscriberFactory(_ref2) {
|
|
|
26176
26176
|
* <li>Total audio and video packets lost</li>
|
|
26177
26177
|
* <li>Total audio and video packets received</li>
|
|
26178
26178
|
* <li>Total audio and video bytes received</li>
|
|
26179
|
-
* <li>
|
|
26179
|
+
* <li>Actual received video resolution (via <a href="#videoWidth">videoWidth()</a> and
|
|
26180
|
+
* <a href="#videoHeight">videoHeight()</a>)</li>
|
|
26181
|
+
* <li>Actual decoded video frame rate (via <code>video.decodedFrameRate</code>)</li>
|
|
26180
26182
|
*
|
|
26181
26183
|
* </ul>
|
|
26182
26184
|
*
|
|
@@ -26860,11 +26862,20 @@ function SubscriberFactory(_ref2) {
|
|
|
26860
26862
|
};
|
|
26861
26863
|
|
|
26862
26864
|
/**
|
|
26863
|
-
* Returns the width, in pixels, of the Subscriber video.
|
|
26865
|
+
* Returns the actual received width, in pixels, of the Subscriber video. This reflects
|
|
26866
|
+
* the decoded resolution of the incoming video stream, which may differ from the
|
|
26867
|
+
* publisher's capture resolution due to network/CPU adaptation or scalable video layer
|
|
26868
|
+
* selection. Use this method to observe the real resolution being rendered for this
|
|
26869
|
+
* subscriber.
|
|
26870
|
+
* <p>
|
|
26871
|
+
* For more information on monitoring stream quality, see the
|
|
26872
|
+
* <a href="https://tokbox.com/developer/guides/client-observability/">Client Observability</a>
|
|
26873
|
+
* developer guide.
|
|
26864
26874
|
*
|
|
26875
|
+
* @see <a href="#getStats">Subscriber.getStats()</a>
|
|
26865
26876
|
* @method #videoWidth
|
|
26866
26877
|
* @memberOf Subscriber
|
|
26867
|
-
* @return {Number}
|
|
26878
|
+
* @return {Number} The actual received width, in pixels, of the Subscriber video.
|
|
26868
26879
|
*/
|
|
26869
26880
|
this.videoWidth = () => {
|
|
26870
26881
|
const video = _widgetView && _widgetView.video();
|
|
@@ -26872,11 +26883,20 @@ function SubscriberFactory(_ref2) {
|
|
|
26872
26883
|
};
|
|
26873
26884
|
|
|
26874
26885
|
/**
|
|
26875
|
-
* Returns the height, in pixels, of the Subscriber video.
|
|
26886
|
+
* Returns the actual received height, in pixels, of the Subscriber video. This reflects
|
|
26887
|
+
* the decoded resolution of the incoming video stream, which may differ from the
|
|
26888
|
+
* publisher's capture resolution due to network or cpu adaptation or scalable video layer
|
|
26889
|
+
* selection. Use this method to observe the real resolution being rendered for this
|
|
26890
|
+
* subscriber.
|
|
26891
|
+
* <p>
|
|
26892
|
+
* For more information on monitoring stream quality, see the
|
|
26893
|
+
* <a href="https://tokbox.com/developer/guides/client-observability/">Client Observability</a>
|
|
26894
|
+
* developer guide.
|
|
26876
26895
|
*
|
|
26896
|
+
* @see <a href="#getStats">Subscriber.getStats()</a>
|
|
26877
26897
|
* @method #videoHeight
|
|
26878
26898
|
* @memberOf Subscriber
|
|
26879
|
-
* @return {Number}
|
|
26899
|
+
* @return {Number} The actual received height, in pixels, of the Subscriber video.
|
|
26880
26900
|
*/
|
|
26881
26901
|
this.videoHeight = () => {
|
|
26882
26902
|
const video = _widgetView && _widgetView.video();
|
|
@@ -28326,14 +28346,26 @@ function SubscriberFactory(_ref2) {
|
|
|
28326
28346
|
*/
|
|
28327
28347
|
|
|
28328
28348
|
/**
|
|
28329
|
-
* Dispatched when the
|
|
28330
|
-
*
|
|
28331
|
-
*
|
|
28332
|
-
*
|
|
28333
|
-
*
|
|
28334
|
-
*
|
|
28335
|
-
*
|
|
28336
|
-
*
|
|
28349
|
+
* Dispatched when the <code>stream.videoDimensions</code> property is updated by the
|
|
28350
|
+
* publisher. This occurs when the publisher's local video element detects a dimension change
|
|
28351
|
+
* and signals the update to all session participants. Examples of what can cause this:
|
|
28352
|
+
* <ul>
|
|
28353
|
+
* <li>When <code>stream.videoType</code> is set to <code>"screen"</code> (screen-sharing)
|
|
28354
|
+
* and the user resizes the captured window.</li>
|
|
28355
|
+
* <li>When the video is being published by a mobile device and the user rotates the device,
|
|
28356
|
+
* causing the camera orientation to change.</li>
|
|
28357
|
+
* <li>When the publisher calls {@link Publisher#setPreferredResolution}, changing the
|
|
28358
|
+
* target capture resolution.</li>
|
|
28359
|
+
* </ul>
|
|
28360
|
+
* This event object has a <code>newValue</code> property and an <code>oldValue</code> property,
|
|
28361
|
+
* representing the new and old dimensions of the video. Each of these has a <code>height</code>
|
|
28362
|
+
* property and a <code>width</code> property, representing the height and width, in pixels.
|
|
28363
|
+
* <p>
|
|
28364
|
+
* Note: these dimensions reflect the publisher's <em>capture</em> resolution (what the
|
|
28365
|
+
* publisher is encoding and sending), not the resolution actually decoded by this subscriber.
|
|
28366
|
+
* The decoded resolution may differ due to network adaptation or scalable video coding.
|
|
28367
|
+
* Use {@link Subscriber#videoWidth} and {@link Subscriber#videoHeight} for the actual
|
|
28368
|
+
* received resolution.
|
|
28337
28369
|
* @name videoDimensionsChanged
|
|
28338
28370
|
* @event
|
|
28339
28371
|
* @memberof Subscriber
|
|
@@ -41891,7 +41923,7 @@ function staticConfigFactory(_temp) {
|
|
|
41891
41923
|
_ref$axios = _ref.axios,
|
|
41892
41924
|
axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
|
|
41893
41925
|
_ref$properties = _ref.properties,
|
|
41894
|
-
properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"
|
|
41926
|
+
properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"6d82efef1","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;
|
|
41895
41927
|
/** @type builtInConfig */
|
|
41896
41928
|
const builtInConfig = (0, _cloneDeep.default)(properties);
|
|
41897
41929
|
/**
|
|
@@ -48509,26 +48541,24 @@ function PublisherFactory(_ref) {
|
|
|
48509
48541
|
};
|
|
48510
48542
|
|
|
48511
48543
|
/**
|
|
48512
|
-
* Returns the width, in pixels, of the
|
|
48513
|
-
* <code
|
|
48514
|
-
*
|
|
48515
|
-
* does not support the requested resolution.
|
|
48544
|
+
* Returns the width, in pixels, of the publisher's local video, read from the
|
|
48545
|
+
* local <code><video></code> element. This is the same value as
|
|
48546
|
+
* <code>stream.videoDimensions.width</code>
|
|
48516
48547
|
*
|
|
48517
48548
|
* @method #videoWidth
|
|
48518
48549
|
* @memberOf Publisher
|
|
48519
|
-
* @return {Number}
|
|
48550
|
+
* @return {Number} The width, in pixels, of the publisher's local video.
|
|
48520
48551
|
*/
|
|
48521
48552
|
this.videoWidth = () => getVideoDimensions().width;
|
|
48522
48553
|
|
|
48523
48554
|
/**
|
|
48524
|
-
* Returns the height, in pixels, of the
|
|
48525
|
-
* <code
|
|
48526
|
-
*
|
|
48527
|
-
* does not support the requested resolution.
|
|
48555
|
+
* Returns the height, in pixels, of the publisher's local video, read from the
|
|
48556
|
+
* local <code><video></code> element. This is the same value as
|
|
48557
|
+
* <code>stream.videoDimensions.height</code>.
|
|
48528
48558
|
*
|
|
48529
48559
|
* @method #videoHeight
|
|
48530
48560
|
* @memberOf Publisher
|
|
48531
|
-
* @return {Number}
|
|
48561
|
+
* @return {Number} The height, in pixels, of the publisher's local video.
|
|
48532
48562
|
*/
|
|
48533
48563
|
this.videoHeight = () => getVideoDimensions().height;
|
|
48534
48564
|
|
|
@@ -50347,12 +50377,21 @@ function PublisherFactory(_ref) {
|
|
|
50347
50377
|
*/
|
|
50348
50378
|
|
|
50349
50379
|
/**
|
|
50350
|
-
* Dispatched when the
|
|
50351
|
-
*
|
|
50352
|
-
*
|
|
50353
|
-
*
|
|
50354
|
-
*
|
|
50355
|
-
* <code>
|
|
50380
|
+
* Dispatched when the publisher's local <code><video></code> element detects a dimension
|
|
50381
|
+
* change. When the publisher is actively publishing, this also updates the
|
|
50382
|
+
* <code>stream.videoDimensions</code> property. Examples of what can cause the local video
|
|
50383
|
+
* element to resize:
|
|
50384
|
+
* <ul>
|
|
50385
|
+
* <li>When <code>stream.videoType</code> is set to <code>"screen"</code> (screen-sharing)
|
|
50386
|
+
* and the user resizes the captured window.</li>
|
|
50387
|
+
* <li>When the video is being published by a mobile device and the user rotates the device,
|
|
50388
|
+
* causing the camera orientation to change.</li>
|
|
50389
|
+
* <li>When the publisher calls {@link Publisher#setPreferredResolution}, changing the
|
|
50390
|
+
* target capture resolution.</li>
|
|
50391
|
+
* </ul>
|
|
50392
|
+
* This event object has a <code>newValue</code> property and an <code>oldValue</code> property,
|
|
50393
|
+
* representing the new and old dimensions of the video. Each of these has a <code>height</code>
|
|
50394
|
+
* property and a <code>width</code> property, representing the height and width, in pixels.
|
|
50356
50395
|
* @name videoDimensionsChanged
|
|
50357
50396
|
* @event
|
|
50358
50397
|
* @memberof Publisher
|
|
@@ -70568,6 +70607,26 @@ function SessionFactory(deps) {
|
|
|
70568
70607
|
return _this;
|
|
70569
70608
|
};
|
|
70570
70609
|
|
|
70610
|
+
/**
|
|
70611
|
+
* The <code>connect</code> function is also available in a promisified flavour.
|
|
70612
|
+
* This function will resolve to a session object at the moment the event
|
|
70613
|
+
* <code>sessionConnected</code> happens if there were no errors.
|
|
70614
|
+
*/
|
|
70615
|
+
this.connect.promise = function () {
|
|
70616
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
70617
|
+
args[_key3] = arguments[_key3];
|
|
70618
|
+
}
|
|
70619
|
+
return new Promise((resolve, reject) => {
|
|
70620
|
+
const session = _this.connect(...args, error => {
|
|
70621
|
+
if (error) {
|
|
70622
|
+
reject(error);
|
|
70623
|
+
} else {
|
|
70624
|
+
resolve(session);
|
|
70625
|
+
}
|
|
70626
|
+
});
|
|
70627
|
+
});
|
|
70628
|
+
};
|
|
70629
|
+
|
|
70571
70630
|
/**
|
|
70572
70631
|
* Disconnects from the Vonage Video API session.
|
|
70573
70632
|
*
|
|
@@ -70618,29 +70677,39 @@ function SessionFactory(deps) {
|
|
|
70618
70677
|
* Dispatched on other clients if streams are lost as a result of the session disconnecting.
|
|
70619
70678
|
* </p>
|
|
70620
70679
|
*
|
|
70680
|
+
* @returns {Promise<void>} A promise that will resolve when the sessionDisconnected event gets fired
|
|
70681
|
+
*
|
|
70621
70682
|
* @method #disconnect
|
|
70622
70683
|
* @memberOf Session
|
|
70623
70684
|
*/
|
|
70624
70685
|
this.disconnect = function () {
|
|
70625
|
-
|
|
70626
|
-
|
|
70627
|
-
|
|
70628
|
-
|
|
70629
|
-
|
|
70630
|
-
cpuPressureMonitor.stopMonitoring();
|
|
70631
|
-
}
|
|
70632
|
-
if (_socket && _socket.isNot('disconnected')) {
|
|
70633
|
-
if (_socket.isNot('disconnecting')) {
|
|
70634
|
-
if (!_socket.isNot('connecting')) {
|
|
70635
|
-
this.logConnectivityEvent('Cancel');
|
|
70686
|
+
return new Promise((resolve, reject) => {
|
|
70687
|
+
try {
|
|
70688
|
+
if (this._singlePeerConnectionController) {
|
|
70689
|
+
this._singlePeerConnectionController.destroy();
|
|
70690
|
+
this._singlePeerConnectionController = null;
|
|
70636
70691
|
}
|
|
70637
|
-
|
|
70638
|
-
|
|
70639
|
-
|
|
70692
|
+
if (cpuPressureMonitor) {
|
|
70693
|
+
cpuPressureMonitor.stopMonitoring();
|
|
70694
|
+
}
|
|
70695
|
+
if (_socket && _socket.isNot('disconnected')) {
|
|
70696
|
+
if (_socket.isNot('disconnecting')) {
|
|
70697
|
+
if (!_socket.isNot('connecting')) {
|
|
70698
|
+
this.logConnectivityEvent('Cancel');
|
|
70699
|
+
}
|
|
70700
|
+
setState('disconnecting');
|
|
70701
|
+
_socket.disconnect();
|
|
70702
|
+
this.off('gsmCallEnded', gsmCallEndedHandler);
|
|
70703
|
+
}
|
|
70704
|
+
this.once('sessionDisconnected', resolve);
|
|
70705
|
+
} else {
|
|
70706
|
+
reset();
|
|
70707
|
+
resolve();
|
|
70708
|
+
}
|
|
70709
|
+
} catch (err) {
|
|
70710
|
+
reject(err);
|
|
70640
70711
|
}
|
|
70641
|
-
}
|
|
70642
|
-
reset();
|
|
70643
|
-
}
|
|
70712
|
+
});
|
|
70644
70713
|
};
|
|
70645
70714
|
this.destroy = function () {
|
|
70646
70715
|
this.streams.destroy();
|
|
@@ -72019,62 +72088,68 @@ function SessionFactory(deps) {
|
|
|
72019
72088
|
* and the signal was sent. It does <i>not</i> indicate that the signal was successfully
|
|
72020
72089
|
* received by any of the intended recipients.
|
|
72021
72090
|
*
|
|
72091
|
+
* @returns {Promise<void>} A promise that resolves when the signal has been sent
|
|
72092
|
+
*
|
|
72022
72093
|
* @method #signal
|
|
72023
72094
|
* @memberOf Session
|
|
72024
72095
|
* @see <a href="#event:signal">signal</a> and <a href="#event:signal:type">signal:type</a> events
|
|
72025
72096
|
*/
|
|
72026
72097
|
this.signal = function (options, completion) {
|
|
72027
|
-
|
|
72028
|
-
|
|
72029
|
-
|
|
72030
|
-
|
|
72031
|
-
|
|
72032
|
-
|
|
72033
|
-
|
|
72034
|
-
const
|
|
72035
|
-
|
|
72036
|
-
|
|
72037
|
-
|
|
72038
|
-
|
|
72039
|
-
|
|
72040
|
-
|
|
72041
|
-
|
|
72042
|
-
return errors.INVALID_PARAMETER;
|
|
72043
|
-
case 429:
|
|
72044
|
-
return errors.RATE_LIMIT_EXCEEDED;
|
|
72045
|
-
case 404:
|
|
72046
|
-
return errors.NOT_FOUND;
|
|
72047
|
-
case 500:
|
|
72048
|
-
return errors.NOT_CONNECTED;
|
|
72049
|
-
case 403:
|
|
72050
|
-
return errors.PERMISSION_DENIED;
|
|
72051
|
-
case 2001:
|
|
72052
|
-
return errors.UNEXPECTED_SERVER_RESPONSE;
|
|
72053
|
-
default:
|
|
72054
|
-
return undefined;
|
|
72098
|
+
return new Promise((resolve, reject) => {
|
|
72099
|
+
let _options = options;
|
|
72100
|
+
let _completion = completion || function () {};
|
|
72101
|
+
if ((0, _isFunction.default)(_options)) {
|
|
72102
|
+
_completion = _options;
|
|
72103
|
+
_options = null;
|
|
72104
|
+
}
|
|
72105
|
+
const errorCallback = function errorCallback() {
|
|
72106
|
+
_completion(...arguments);
|
|
72107
|
+
reject(...arguments);
|
|
72108
|
+
};
|
|
72109
|
+
if (!this.isConnected()) {
|
|
72110
|
+
const notConnectedErrorMsg = 'Unable to send signal - you are not connected to the session.';
|
|
72111
|
+
dispatchOTError(otError(errors.NOT_CONNECTED, new Error(notConnectedErrorMsg), 500), errorCallback);
|
|
72112
|
+
return;
|
|
72055
72113
|
}
|
|
72056
|
-
|
|
72057
|
-
|
|
72058
|
-
|
|
72059
|
-
|
|
72060
|
-
|
|
72061
|
-
|
|
72062
|
-
|
|
72063
|
-
|
|
72064
|
-
|
|
72065
|
-
|
|
72114
|
+
function getErrorNameFromCode(code) {
|
|
72115
|
+
switch (code) {
|
|
72116
|
+
case 400:
|
|
72117
|
+
case 413:
|
|
72118
|
+
return errors.INVALID_PARAMETER;
|
|
72119
|
+
case 429:
|
|
72120
|
+
return errors.RATE_LIMIT_EXCEEDED;
|
|
72121
|
+
case 404:
|
|
72122
|
+
return errors.NOT_FOUND;
|
|
72123
|
+
case 500:
|
|
72124
|
+
return errors.NOT_CONNECTED;
|
|
72125
|
+
case 403:
|
|
72126
|
+
return errors.PERMISSION_DENIED;
|
|
72127
|
+
case 2001:
|
|
72128
|
+
return errors.UNEXPECTED_SERVER_RESPONSE;
|
|
72129
|
+
default:
|
|
72130
|
+
return undefined;
|
|
72066
72131
|
}
|
|
72067
|
-
|
|
72132
|
+
}
|
|
72133
|
+
if (!_socket) {
|
|
72134
|
+
dispatchSocketIsNullError('signal', errorCallback);
|
|
72068
72135
|
return;
|
|
72069
72136
|
}
|
|
72070
|
-
|
|
72071
|
-
|
|
72137
|
+
_socket.signal(_options, error => {
|
|
72138
|
+
if (error) {
|
|
72139
|
+
const errorName = getErrorNameFromCode(error.code);
|
|
72140
|
+
if (errorName) {
|
|
72141
|
+
error = otError(errorName, new Error(error.message), error.code);
|
|
72142
|
+
}
|
|
72143
|
+
errorCallback(error);
|
|
72144
|
+
return;
|
|
72145
|
+
}
|
|
72146
|
+
_completion();
|
|
72147
|
+
resolve();
|
|
72148
|
+
}, this.logEvent);
|
|
72149
|
+
if (options && options.data && typeof options.data !== 'string') {
|
|
72150
|
+
_logging.warn('Signaling of anything other than Strings is deprecated. ' + 'Please update the data property to be a string.');
|
|
72072
72151
|
}
|
|
72073
|
-
|
|
72074
|
-
}, this.logEvent);
|
|
72075
|
-
if (options && options.data && typeof options.data !== 'string') {
|
|
72076
|
-
_logging.warn('Signaling of anything other than Strings is deprecated. ' + 'Please update the data property to be a string.');
|
|
72077
|
-
}
|
|
72152
|
+
});
|
|
72078
72153
|
};
|
|
72079
72154
|
|
|
72080
72155
|
/**
|
|
@@ -72155,40 +72230,49 @@ function SessionFactory(deps) {
|
|
|
72155
72230
|
* });
|
|
72156
72231
|
* </pre>
|
|
72157
72232
|
*
|
|
72233
|
+
* @returns {Promise<void>} A promise that resolves when the disconnection happens
|
|
72234
|
+
*
|
|
72158
72235
|
* @method #forceDisconnect
|
|
72159
72236
|
* @memberOf Session
|
|
72160
72237
|
*/
|
|
72161
72238
|
|
|
72162
72239
|
this.forceDisconnect = function (connectionOrConnectionId, completionHandler) {
|
|
72163
|
-
if (
|
|
72164
|
-
|
|
72165
|
-
dispatchOTError(otError(errors.NOT_CONNECTED, new Error(notConnectedErrorMsg), ExceptionCodes.NOT_CONNECTED), completionHandler);
|
|
72166
|
-
return;
|
|
72167
|
-
}
|
|
72168
|
-
const connectionId = typeof connectionOrConnectionId === 'string' ? connectionOrConnectionId : connectionOrConnectionId.id;
|
|
72169
|
-
const invalidParameterErrorMsg = 'Invalid Parameter. Check that you have passed valid parameter values into the method call.';
|
|
72170
|
-
if (!connectionId) {
|
|
72171
|
-
dispatchOTError(otError(errors.INVALID_PARAMETER, new Error(invalidParameterErrorMsg), ExceptionCodes.INVALID_PARAMETER), completionHandler);
|
|
72172
|
-
return;
|
|
72173
|
-
}
|
|
72174
|
-
const notPermittedErrorMsg = 'This token does not allow forceDisconnect. ' + 'The role must be at least `moderator` to enable this functionality';
|
|
72175
|
-
if (!permittedTo('forceDisconnect')) {
|
|
72176
|
-
dispatchOTError(otError(errors.PERMISSION_DENIED, new Error(notPermittedErrorMsg), ExceptionCodes.UNABLE_TO_FORCE_DISCONNECT), completionHandler);
|
|
72177
|
-
return;
|
|
72178
|
-
}
|
|
72179
|
-
if (!_socket) {
|
|
72180
|
-
dispatchSocketIsNullError('forceDisconnect', completionHandler);
|
|
72181
|
-
return;
|
|
72240
|
+
if (completionHandler === void 0) {
|
|
72241
|
+
completionHandler = () => {};
|
|
72182
72242
|
}
|
|
72183
|
-
|
|
72184
|
-
|
|
72185
|
-
|
|
72186
|
-
|
|
72187
|
-
|
|
72188
|
-
|
|
72189
|
-
|
|
72190
|
-
|
|
72243
|
+
return new Promise((resolve, reject) => {
|
|
72244
|
+
const errorCallback = function errorCallback() {
|
|
72245
|
+
if (typeof completionHandler === 'function') completionHandler(...arguments);
|
|
72246
|
+
reject(...arguments);
|
|
72247
|
+
};
|
|
72248
|
+
if (!this.isConnected()) {
|
|
72249
|
+
const notConnectedErrorMsg = 'Cannot call forceDisconnect(). You are not ' + 'connected to the session.';
|
|
72250
|
+
dispatchOTError(otError(errors.NOT_CONNECTED, new Error(notConnectedErrorMsg), ExceptionCodes.NOT_CONNECTED), errorCallback);
|
|
72251
|
+
return;
|
|
72191
72252
|
}
|
|
72253
|
+
const connectionId = typeof connectionOrConnectionId === 'string' ? connectionOrConnectionId : connectionOrConnectionId.id;
|
|
72254
|
+
const invalidParameterErrorMsg = 'Invalid Parameter. Check that you have passed valid parameter values into the method call.';
|
|
72255
|
+
if (!connectionId) {
|
|
72256
|
+
dispatchOTError(otError(errors.INVALID_PARAMETER, new Error(invalidParameterErrorMsg), ExceptionCodes.INVALID_PARAMETER), errorCallback);
|
|
72257
|
+
return;
|
|
72258
|
+
}
|
|
72259
|
+
const notPermittedErrorMsg = 'This token does not allow forceDisconnect. ' + 'The role must be at least `moderator` to enable this functionality';
|
|
72260
|
+
if (!permittedTo('forceDisconnect')) {
|
|
72261
|
+
dispatchOTError(otError(errors.PERMISSION_DENIED, new Error(notPermittedErrorMsg), ExceptionCodes.UNABLE_TO_FORCE_DISCONNECT), errorCallback);
|
|
72262
|
+
return;
|
|
72263
|
+
}
|
|
72264
|
+
if (!_socket) {
|
|
72265
|
+
dispatchSocketIsNullError('forceDisconnect', errorCallback);
|
|
72266
|
+
return;
|
|
72267
|
+
}
|
|
72268
|
+
_socket.forceDisconnect(connectionId, err => {
|
|
72269
|
+
if (err) {
|
|
72270
|
+
dispatchOTError(otError(errors.INVALID_PARAMETER, new Error(invalidParameterErrorMsg), ExceptionCodes.INVALID_PARAMETER), errorCallback);
|
|
72271
|
+
} else {
|
|
72272
|
+
completionHandler();
|
|
72273
|
+
resolve();
|
|
72274
|
+
}
|
|
72275
|
+
});
|
|
72192
72276
|
});
|
|
72193
72277
|
};
|
|
72194
72278
|
|
|
@@ -72246,6 +72330,8 @@ function SessionFactory(deps) {
|
|
|
72246
72330
|
* });
|
|
72247
72331
|
* </pre>
|
|
72248
72332
|
*
|
|
72333
|
+
* @returns {Promise<void>} A promise that resolves when the unpublish happens
|
|
72334
|
+
*
|
|
72249
72335
|
* @method #forceUnpublish
|
|
72250
72336
|
* @memberOf Session
|
|
72251
72337
|
*/
|
|
@@ -72254,61 +72340,68 @@ function SessionFactory(deps) {
|
|
|
72254
72340
|
if (completionHandler === void 0) {
|
|
72255
72341
|
completionHandler = () => {};
|
|
72256
72342
|
}
|
|
72257
|
-
|
|
72258
|
-
|
|
72259
|
-
|
|
72260
|
-
|
|
72261
|
-
|
|
72262
|
-
|
|
72263
|
-
|
|
72264
|
-
|
|
72265
|
-
|
|
72266
|
-
|
|
72267
|
-
|
|
72268
|
-
|
|
72269
|
-
|
|
72270
|
-
|
|
72271
|
-
|
|
72272
|
-
|
|
72273
|
-
|
|
72274
|
-
|
|
72275
|
-
|
|
72276
|
-
|
|
72277
|
-
|
|
72278
|
-
|
|
72279
|
-
|
|
72280
|
-
|
|
72281
|
-
|
|
72282
|
-
|
|
72283
|
-
|
|
72284
|
-
|
|
72285
|
-
|
|
72286
|
-
|
|
72287
|
-
|
|
72288
|
-
|
|
72289
|
-
|
|
72290
|
-
|
|
72291
|
-
|
|
72292
|
-
|
|
72293
|
-
dispatchError(notPermittedError);
|
|
72294
|
-
return;
|
|
72295
|
-
}
|
|
72296
|
-
if (!_socket) {
|
|
72297
|
-
dispatchSocketIsNullError('forceUnpublish', completionHandler);
|
|
72298
|
-
return;
|
|
72299
|
-
}
|
|
72300
|
-
_socket.forceUnpublish(stream.id, err => {
|
|
72301
|
-
if (!err) {
|
|
72302
|
-
completionHandler(null);
|
|
72343
|
+
return new Promise((resolve, reject) => {
|
|
72344
|
+
const errorCallback = function errorCallback() {
|
|
72345
|
+
if (typeof completionHandler === 'function') completionHandler(...arguments);
|
|
72346
|
+
reject(...arguments);
|
|
72347
|
+
};
|
|
72348
|
+
const dispatchError = err => dispatchOTError(otError(err.name, new Error(err.msg), err.code), errorCallback);
|
|
72349
|
+
const invalidParameterError = {
|
|
72350
|
+
msg: 'Invalid Parameter. Check that you have passed valid parameter values into the method call.',
|
|
72351
|
+
code: ExceptionCodes.INVALID_PARAMETER,
|
|
72352
|
+
name: errors.INVALID_PARAMETER
|
|
72353
|
+
};
|
|
72354
|
+
const notConnectedError = {
|
|
72355
|
+
msg: 'Cannot call forceUnpublish(). You are not connected to the session.',
|
|
72356
|
+
code: ExceptionCodes.NOT_CONNECTED,
|
|
72357
|
+
name: errors.NOT_CONNECTED
|
|
72358
|
+
};
|
|
72359
|
+
const notPermittedError = {
|
|
72360
|
+
msg: 'This token does not allow forceUnpublish. The role must be at least `moderator` to enable this ' + 'functionality',
|
|
72361
|
+
code: ExceptionCodes.UNABLE_TO_FORCE_UNPUBLISH,
|
|
72362
|
+
name: errors.PERMISSION_DENIED
|
|
72363
|
+
};
|
|
72364
|
+
const notFoundError = {
|
|
72365
|
+
msg: 'The stream does not exist.',
|
|
72366
|
+
name: errors.NOT_FOUND
|
|
72367
|
+
};
|
|
72368
|
+
const unexpectedError = {
|
|
72369
|
+
msg: 'An unexpected error occurred.',
|
|
72370
|
+
name: errors.UNEXPECTED_SERVER_RESPONSE,
|
|
72371
|
+
code: ExceptionCodes.UNEXPECTED_SERVER_RESPONSE
|
|
72372
|
+
};
|
|
72373
|
+
if (!streamOrStreamId) {
|
|
72374
|
+
dispatchError(invalidParameterError);
|
|
72375
|
+
return;
|
|
72376
|
+
}
|
|
72377
|
+
if (!_this.isConnected()) {
|
|
72378
|
+
dispatchError(notConnectedError);
|
|
72303
72379
|
return;
|
|
72304
72380
|
}
|
|
72305
|
-
|
|
72306
|
-
|
|
72307
|
-
|
|
72381
|
+
const stream = getStream(streamOrStreamId);
|
|
72382
|
+
if (!permittedTo('forceUnpublish')) {
|
|
72383
|
+
// if this throws an error the handleJsException won't occur
|
|
72308
72384
|
dispatchError(notPermittedError);
|
|
72309
|
-
|
|
72310
|
-
dispatchError(unexpectedError);
|
|
72385
|
+
return;
|
|
72311
72386
|
}
|
|
72387
|
+
if (!_socket) {
|
|
72388
|
+
dispatchSocketIsNullError('forceUnpublish', errorCallback);
|
|
72389
|
+
return;
|
|
72390
|
+
}
|
|
72391
|
+
_socket.forceUnpublish(stream.id, err => {
|
|
72392
|
+
if (!err) {
|
|
72393
|
+
completionHandler();
|
|
72394
|
+
resolve();
|
|
72395
|
+
return;
|
|
72396
|
+
}
|
|
72397
|
+
if (err.code === '404') {
|
|
72398
|
+
dispatchError(notFoundError);
|
|
72399
|
+
} else if (err.code === '403') {
|
|
72400
|
+
dispatchError(notPermittedError);
|
|
72401
|
+
} else {
|
|
72402
|
+
dispatchError(unexpectedError);
|
|
72403
|
+
}
|
|
72404
|
+
});
|
|
72312
72405
|
});
|
|
72313
72406
|
};
|
|
72314
72407
|
|
|
@@ -79995,8 +80088,17 @@ function EventsFactory(deps) {
|
|
|
79995
80088
|
};
|
|
79996
80089
|
|
|
79997
80090
|
/**
|
|
79998
|
-
* Dispatched when the video dimensions of
|
|
79999
|
-
*
|
|
80091
|
+
* Dispatched when the video dimensions of a published stream change.
|
|
80092
|
+
* <p>
|
|
80093
|
+
* On the <strong>Publisher</strong>, this event fires when the publisher's local
|
|
80094
|
+
* <code><video></code> element detects a dimension change. When the publisher is
|
|
80095
|
+
* actively publishing, this also updates the <code>stream.videoDimensions</code> property.
|
|
80096
|
+
* Examples of what can cause the local video element to resize: resizing a captured
|
|
80097
|
+
* screen-sharing window, rotating a mobile device (changing camera orientation), or calling
|
|
80098
|
+
* <code>Publisher.setPreferredResolution()</code>.
|
|
80099
|
+
* <p>
|
|
80100
|
+
* On the <strong>Subscriber</strong>, this event fires when the <code>stream.videoDimensions</code>
|
|
80101
|
+
* property is updated by the publisher.
|
|
80000
80102
|
*
|
|
80001
80103
|
* @class VideoDimensionsChangedEvent
|
|
80002
80104
|
* @property {Object} newValue The new video dimensions (after the change). This object has two
|
|
@@ -107408,9 +107510,19 @@ const validPropertyNames = ['name', 'archiving'];
|
|
|
107408
107510
|
* Date object by calling <code>new Date(creationTime)</code>, where <code>creationTime</code> is
|
|
107409
107511
|
* the <code>creationTime</code> property of the Stream object.
|
|
107410
107512
|
*
|
|
107411
|
-
* @property {Number} frameRate The
|
|
107412
|
-
*
|
|
107413
|
-
* <
|
|
107513
|
+
* @property {Number} frameRate The publisher's capture target frame rate.
|
|
107514
|
+
* Initially derived from the <code>frameRate</code> property passed to
|
|
107515
|
+
* <a href="OT.html#initPublisher">OT.initPublisher()</a>. This property is only set if the
|
|
107516
|
+
* publisher explicitly specifies a frame rate; otherwise, it is undefined. This value is
|
|
107517
|
+
* updated when the publisher calls
|
|
107518
|
+
* <a href="Publisher.html#setPreferredFrameRate">Publisher.setPreferredFrameRate()</a>.
|
|
107519
|
+
* <p>
|
|
107520
|
+
* <b>Note:</b> This value represents the publisher's current target capture frame rate, not
|
|
107521
|
+
* the frame rate actually encoded or received by a subscriber. The encoded frame rate may
|
|
107522
|
+
* still be lower due to bandwidth or CPU constraints, and the received frame rate can vary
|
|
107523
|
+
* further based on network conditions. To get the real decoded frame rate for a subscriber,
|
|
107524
|
+
* use the <code>video.decodedFrameRate</code> property returned by
|
|
107525
|
+
* <a href="Subscriber.html#getStats">Subscriber.getStats()</a>.
|
|
107414
107526
|
*
|
|
107415
107527
|
* @property {Boolean} hasCaptions Whether the stream has captions. This property can change if the
|
|
107416
107528
|
* publisher turns captions on or off (by calling the
|
|
@@ -107442,13 +107554,26 @@ const validPropertyNames = ['name', 'archiving'];
|
|
|
107442
107554
|
* @property {String} streamId The unique ID of the stream.
|
|
107443
107555
|
*
|
|
107444
107556
|
* @property {Object} videoDimensions This object has two properties: <code>width</code> and
|
|
107445
|
-
* <code>height</code
|
|
107446
|
-
*
|
|
107447
|
-
*
|
|
107448
|
-
*
|
|
107449
|
-
*
|
|
107450
|
-
*
|
|
107451
|
-
* (
|
|
107557
|
+
* <code>height</code> (both numbers). These represent the publisher's capture target resolution
|
|
107558
|
+
* last signaled to the session. The value is broadcast to all participants via the
|
|
107559
|
+
* signaling layer and is readable on both the publishing and subscribing clients.
|
|
107560
|
+
* <p>
|
|
107561
|
+
* The value is set initially from the <code>resolution</code> property passed to
|
|
107562
|
+
* <a href="OT.html#initPublisher">OT.initPublisher()</a>. It is updated at runtime when the
|
|
107563
|
+
* publisher's local <code><video></code> element detects a dimension change (for example,
|
|
107564
|
+
* after a call to
|
|
107565
|
+
* <a href="Publisher.html#setPreferredResolution">Publisher.setPreferredResolution()</a>,
|
|
107566
|
+
* a screen-sharing window resize, or a mobile device rotation).
|
|
107567
|
+
* <p>
|
|
107568
|
+
* <b>Note:</b> These values represent the publisher's capture target resolution, not the resolution
|
|
107569
|
+
* actually encoded or received by a subscriber. The publisher may encode at a lower resolution
|
|
107570
|
+
* due to bandwidth or CPU constraints, and subscribers using scalable video may receive an even
|
|
107571
|
+
* lower resolution layer. To get the actual decoded resolution on the subscribing client, use
|
|
107572
|
+
* <a href="Subscriber.html#videoWidth">Subscriber.videoWidth()</a> and
|
|
107573
|
+
* <a href="Subscriber.html#videoHeight">Subscriber.videoHeight()</a>.
|
|
107574
|
+
* <p>
|
|
107575
|
+
* When this property changes, the {@link Session} object dispatches a
|
|
107576
|
+
* <code>streamPropertyChanged</code> event (see {@link StreamPropertyChangedEvent}).
|
|
107452
107577
|
*
|
|
107453
107578
|
* @property {String} videoType The type of video — either <code>"camera"</code>,
|
|
107454
107579
|
* <code>"screen"</code>, or <code>"custom"</code>.
|