@opentok/client 2.27.5 → 2.27.7
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 -0
- package/dist/js/opentok.js +172 -126
- package/dist/js/opentok.js.map +1 -1
- package/dist/js/opentok.min.js +8 -8
- 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.27.
|
|
2
|
+
* @license OpenTok.js 2.27.7 7bb2355
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2010-2024 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: Fri, 21 Jun 2024 17:32:09 GMT
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -6753,6 +6753,13 @@ function EventsFactory(deps) {
|
|
|
6753
6753
|
captionsEnabled
|
|
6754
6754
|
});
|
|
6755
6755
|
};
|
|
6756
|
+
|
|
6757
|
+
// WILL NEED TO DOCUMENT THIS FOR BOTH SUB AND PUB
|
|
6758
|
+
Events.MediaStreamAvailable = function MediaStreamAvailable(mediaStream) {
|
|
6759
|
+
return new _Event4.default('mediaStreamAvailable', false, {
|
|
6760
|
+
mediaStream
|
|
6761
|
+
});
|
|
6762
|
+
};
|
|
6756
6763
|
Events.StreamUpdatedEvent = function StreamUpdatedEvent(stream, key, oldValue, newValue) {
|
|
6757
6764
|
return new _Event4.default('updated', false, {
|
|
6758
6765
|
target: stream,
|
|
@@ -7922,7 +7929,7 @@ const logging = (0, _log.default)('StaticConfig');
|
|
|
7922
7929
|
*/
|
|
7923
7930
|
|
|
7924
7931
|
/** @type builtInConfig */
|
|
7925
|
-
const builtInConfig = (0, _cloneDeep.default)({"version":"v2.27.
|
|
7932
|
+
const builtInConfig = (0, _cloneDeep.default)({"version":"v2.27.7","buildHash":"7bb2355","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"});
|
|
7926
7933
|
const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
|
|
7927
7934
|
const liveConfigMap = {
|
|
7928
7935
|
apiUrl: 'apiURL',
|
|
@@ -9699,33 +9706,40 @@ function PeerConnectionFactory(deps) {
|
|
|
9699
9706
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
9700
9707
|
while (1) switch (_context4.prev = _context4.next) {
|
|
9701
9708
|
case 0:
|
|
9702
|
-
|
|
9709
|
+
if (api.iceConnectionStateIsConnected()) {
|
|
9710
|
+
_context4.next = 3;
|
|
9711
|
+
break;
|
|
9712
|
+
}
|
|
9713
|
+
api.once('iceConnected', () => api.startDecryption(connectionId, transceiver));
|
|
9714
|
+
return _context4.abrupt("return");
|
|
9715
|
+
case 3:
|
|
9716
|
+
_context4.next = 5;
|
|
9703
9717
|
return extractSenderId({
|
|
9704
9718
|
sessionId,
|
|
9705
9719
|
connectionId
|
|
9706
9720
|
});
|
|
9707
|
-
case
|
|
9721
|
+
case 5:
|
|
9708
9722
|
senderId = _context4.sent;
|
|
9709
9723
|
receiver = transceiver.receiver;
|
|
9710
|
-
_context4.next =
|
|
9711
|
-
return getOrCreateSFrameReceiverClient(
|
|
9712
|
-
case
|
|
9724
|
+
_context4.next = 9;
|
|
9725
|
+
return getOrCreateSFrameReceiverClient(senderId);
|
|
9726
|
+
case 9:
|
|
9713
9727
|
sFrameReceiverClient = _context4.sent;
|
|
9714
|
-
_context4.prev =
|
|
9715
|
-
_context4.next =
|
|
9728
|
+
_context4.prev = 10;
|
|
9729
|
+
_context4.next = 13;
|
|
9716
9730
|
return sFrameReceiverClient == null ? void 0 : sFrameReceiverClient.decrypt(senderId, receiver);
|
|
9717
|
-
case
|
|
9718
|
-
_context4.next =
|
|
9731
|
+
case 13:
|
|
9732
|
+
_context4.next = 18;
|
|
9719
9733
|
break;
|
|
9720
|
-
case 12:
|
|
9721
|
-
_context4.prev = 12;
|
|
9722
|
-
_context4.t0 = _context4["catch"](7);
|
|
9723
|
-
logging.error(_context4.t0);
|
|
9724
9734
|
case 15:
|
|
9735
|
+
_context4.prev = 15;
|
|
9736
|
+
_context4.t0 = _context4["catch"](10);
|
|
9737
|
+
logging.error(_context4.t0);
|
|
9738
|
+
case 18:
|
|
9725
9739
|
case "end":
|
|
9726
9740
|
return _context4.stop();
|
|
9727
9741
|
}
|
|
9728
|
-
}, _callee4, null, [[
|
|
9742
|
+
}, _callee4, null, [[10, 15]]);
|
|
9729
9743
|
}));
|
|
9730
9744
|
return function (_x3, _x4) {
|
|
9731
9745
|
return _ref6.apply(this, arguments);
|
|
@@ -9733,24 +9747,16 @@ function PeerConnectionFactory(deps) {
|
|
|
9733
9747
|
}();
|
|
9734
9748
|
_readyToCompleteOffer.resolve();
|
|
9735
9749
|
const getOrCreateSFrameReceiverClient = /*#__PURE__*/function () {
|
|
9736
|
-
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(
|
|
9737
|
-
var sFrameSenderId;
|
|
9750
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(sFrameSenderId) {
|
|
9738
9751
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
9739
9752
|
while (1) switch (_context6.prev = _context6.next) {
|
|
9740
9753
|
case 0:
|
|
9741
|
-
_context6.next = 2;
|
|
9742
|
-
return extractSenderId({
|
|
9743
|
-
sessionId,
|
|
9744
|
-
connectionId
|
|
9745
|
-
});
|
|
9746
|
-
case 2:
|
|
9747
|
-
sFrameSenderId = _context6.sent;
|
|
9748
9754
|
if (!asyncSFrameReceiverClients[sFrameSenderId]) {
|
|
9749
|
-
_context6.next =
|
|
9755
|
+
_context6.next = 2;
|
|
9750
9756
|
break;
|
|
9751
9757
|
}
|
|
9752
9758
|
return _context6.abrupt("return", asyncSFrameReceiverClients[sFrameSenderId]);
|
|
9753
|
-
case
|
|
9759
|
+
case 2:
|
|
9754
9760
|
asyncSFrameReceiverClients[sFrameSenderId] = new Promise( /*#__PURE__*/function () {
|
|
9755
9761
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(resolve) {
|
|
9756
9762
|
var sharedKey, sFrameReceiverClient;
|
|
@@ -9794,7 +9800,7 @@ function PeerConnectionFactory(deps) {
|
|
|
9794
9800
|
};
|
|
9795
9801
|
}());
|
|
9796
9802
|
return _context6.abrupt("return", asyncSFrameReceiverClients[sFrameSenderId]);
|
|
9797
|
-
case
|
|
9803
|
+
case 4:
|
|
9798
9804
|
case "end":
|
|
9799
9805
|
return _context6.stop();
|
|
9800
9806
|
}
|
|
@@ -16904,7 +16910,6 @@ function PublisherFactory(_ref) {
|
|
|
16904
16910
|
}
|
|
16905
16911
|
/** @type {WidgetView|null} */
|
|
16906
16912
|
let widgetView;
|
|
16907
|
-
let lastRequestedStreamId;
|
|
16908
16913
|
let webRTCStream;
|
|
16909
16914
|
let publishStartTime;
|
|
16910
16915
|
let microphone;
|
|
@@ -16932,17 +16937,18 @@ function PublisherFactory(_ref) {
|
|
|
16932
16937
|
/** @type IntervalRunnerDefault | undefined */
|
|
16933
16938
|
let connectivityAttemptPinger;
|
|
16934
16939
|
|
|
16935
|
-
//
|
|
16940
|
+
// _session mimics the publisher.session variable except it's never set to null
|
|
16936
16941
|
// this allows analytics to refer to it in cases where we disconnect/destroy
|
|
16937
16942
|
// and go to log analytics and publisher.session has been set to null
|
|
16938
|
-
let
|
|
16943
|
+
let _session;
|
|
16939
16944
|
const _options = options,
|
|
16940
16945
|
_enableSenderStats = _options._enableSenderStats;
|
|
16941
|
-
const
|
|
16946
|
+
const getSession = () => this.session || _session || {
|
|
16942
16947
|
isConnected() {
|
|
16943
16948
|
return false;
|
|
16944
16949
|
}
|
|
16945
16950
|
};
|
|
16951
|
+
const getStreamId = () => this.streamId || '';
|
|
16946
16952
|
const streamChannels = [];
|
|
16947
16953
|
const mediaProcessor = new MediaProcessor();
|
|
16948
16954
|
const amrAudioTrackProcessor = new _amrAudioTrackProcessor.default();
|
|
@@ -16966,8 +16972,8 @@ function PublisherFactory(_ref) {
|
|
|
16966
16972
|
});
|
|
16967
16973
|
function getCommonAnalyticsFields() {
|
|
16968
16974
|
return {
|
|
16969
|
-
connectionId:
|
|
16970
|
-
streamId:
|
|
16975
|
+
connectionId: getSession().isConnected() ? getSession().connection.connectionId : null,
|
|
16976
|
+
streamId: getStreamId(),
|
|
16971
16977
|
widgetType: 'Publisher'
|
|
16972
16978
|
};
|
|
16973
16979
|
}
|
|
@@ -17278,7 +17284,7 @@ function PublisherFactory(_ref) {
|
|
|
17278
17284
|
peerId,
|
|
17279
17285
|
widgetType: 'Publisher',
|
|
17280
17286
|
connectionId: this.session && this.session.isConnected() ? this.session.connection.connectionId : null,
|
|
17281
|
-
streamId:
|
|
17287
|
+
streamId: this.streamId,
|
|
17282
17288
|
width: widgetView.width,
|
|
17283
17289
|
height: widgetView.height,
|
|
17284
17290
|
audioTrack: webRTCStream && webRTCStream.getAudioTracks().length > 0,
|
|
@@ -17558,7 +17564,6 @@ function PublisherFactory(_ref) {
|
|
|
17558
17564
|
// Disconnect immediately, rather than wait for the WebSocket to
|
|
17559
17565
|
// reply to our destroyStream message.
|
|
17560
17566
|
this.disconnect();
|
|
17561
|
-
this.session = null;
|
|
17562
17567
|
|
|
17563
17568
|
// We're back to being a stand-alone publisher again.
|
|
17564
17569
|
if (!state.isDestroyed()) {
|
|
@@ -18031,6 +18036,7 @@ function PublisherFactory(_ref) {
|
|
|
18031
18036
|
this.stream = null;
|
|
18032
18037
|
loaded = false;
|
|
18033
18038
|
this.session = null;
|
|
18039
|
+
this.streamId = null;
|
|
18034
18040
|
if (!state.isDestroyed()) {
|
|
18035
18041
|
state.set('NotPublishing');
|
|
18036
18042
|
}
|
|
@@ -18473,6 +18479,7 @@ function PublisherFactory(_ref) {
|
|
|
18473
18479
|
}
|
|
18474
18480
|
});
|
|
18475
18481
|
widgetView.on('videoElementCreated', element => {
|
|
18482
|
+
this.dispatchEvent(new Events.MediaStreamAvailable(webRTCStream));
|
|
18476
18483
|
const event = new Events.VideoElementCreatedEvent(element);
|
|
18477
18484
|
this.dispatchEvent(event);
|
|
18478
18485
|
});
|
|
@@ -20501,15 +20508,22 @@ function PublisherFactory(_ref) {
|
|
|
20501
20508
|
}))();
|
|
20502
20509
|
},
|
|
20503
20510
|
publishToSession: (session, analyticsReplacement) => {
|
|
20511
|
+
// Check if it is already publishing, i.e. 'PublishingToSession' or 'Publishing'
|
|
20512
|
+
// - 'PublishingToSession' is the state we are establishing the Publisher with Rumor.
|
|
20513
|
+
// - 'Publishing' is the state of publishing to the platform.
|
|
20514
|
+
const isAlreadyPublishing = state.current === 'PublishingToSession' || state.isPublishing();
|
|
20515
|
+
if (isAlreadyPublishing) {
|
|
20516
|
+
logging.warn(`This publisher is already publishing to the session. If you want to
|
|
20517
|
+
republish, please unpublish first.`);
|
|
20518
|
+
return Promise.resolve();
|
|
20519
|
+
}
|
|
20504
20520
|
if (analyticsReplacement) {
|
|
20505
20521
|
analytics = analyticsReplacement;
|
|
20506
20522
|
}
|
|
20507
20523
|
// Add session property to Publisher
|
|
20508
|
-
previousSession = session;
|
|
20509
20524
|
this.session = session;
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
this.streamId = requestedStreamId;
|
|
20525
|
+
_session = session;
|
|
20526
|
+
this.streamId = (0, _uuid.default)();
|
|
20513
20527
|
logConnectivityEvent('Attempt', {
|
|
20514
20528
|
dataChannels: properties.channels,
|
|
20515
20529
|
properties: (0, _whitelistPublisherProperties.default)(properties)
|
|
@@ -20647,8 +20661,6 @@ function PublisherFactory(_ref) {
|
|
|
20647
20661
|
type: 'audio',
|
|
20648
20662
|
active: properties.publishAudio
|
|
20649
20663
|
}));
|
|
20650
|
-
}
|
|
20651
|
-
if (didRequestAudio && hasAudioTrack) {
|
|
20652
20664
|
streamChannels.push(new StreamChannel({
|
|
20653
20665
|
id: 'caption1',
|
|
20654
20666
|
type: 'data',
|
|
@@ -20684,7 +20696,7 @@ function PublisherFactory(_ref) {
|
|
|
20684
20696
|
const streamId = maybeStream.streamId,
|
|
20685
20697
|
message = maybeStream.message;
|
|
20686
20698
|
logging.debug('publishToSession: rumor stream id created:', streamId, '(this is different from stream#created, which requires media to actually be ' + 'flowing for mantis sessions)');
|
|
20687
|
-
if (streamId !==
|
|
20699
|
+
if (streamId !== this.streamId) {
|
|
20688
20700
|
throw new Error('streamId response does not match request');
|
|
20689
20701
|
}
|
|
20690
20702
|
this.streamId = streamId;
|
|
@@ -20730,14 +20742,13 @@ function PublisherFactory(_ref) {
|
|
|
20730
20742
|
const err = new Error(createErrorFromReason());
|
|
20731
20743
|
this.trigger('publishComplete', otError(reason === 'mediaStopped' ? Errors.MEDIA_ENDED : Errors.CANCEL, err));
|
|
20732
20744
|
}
|
|
20733
|
-
this.session = null;
|
|
20734
20745
|
logAnalyticsEvent('unpublish', 'Success');
|
|
20735
20746
|
this._.streamDestroyed(reason);
|
|
20736
20747
|
return this;
|
|
20737
20748
|
},
|
|
20738
20749
|
unpublishStreamFromSession: (stream, session, reason) => {
|
|
20739
|
-
if (
|
|
20740
|
-
logging.warn(`The publisher ${guid} is trying to destroy a stream ${stream.id} that is not attached to it
|
|
20750
|
+
if (stream.id !== this.streamId) {
|
|
20751
|
+
logging.warn(`The publisher ${guid} is trying to destroy a stream ${stream.id} that is not attached to it`);
|
|
20741
20752
|
return this;
|
|
20742
20753
|
}
|
|
20743
20754
|
return this._.unpublishFromSession(session, reason);
|
|
@@ -33377,7 +33388,7 @@ var _amrVideoBufferError = __webpack_require__(322);
|
|
|
33377
33388
|
var _updateTrackOnStream = _interopRequireDefault(__webpack_require__(331));
|
|
33378
33389
|
var _time = _interopRequireDefault(__webpack_require__(110));
|
|
33379
33390
|
var _amrStates = _interopRequireDefault(__webpack_require__(325));
|
|
33380
|
-
const _excluded = ["AudioLevelMeter", "AudioLevelTransformer", "BackingBar", "Chrome", "env", "Errors", "Events", "ExceptionCodes", "audioLevelSamplerFactory", "getStatsHelpers", "hasAudioOutputLevelStatCapability", "hasRemoteStreamsWithWebAudio", "interpretPeerConnectionError", "logging", "MuteButton", "NamePanel", "otError", "OTErrorClass", "OTHelpers", "StylableComponent", "SubscriberPeerConnection", "SubscribingState", "VideoDisabledIndicator", "AudioBlockedIndicator", "VideoUnsupportedIndicator", "watchFrameRate", "createSendMethod", "parseIceServers", "document", "WidgetView", "createAudioConnector", "ResizeObserverPolyfill", "AMRStateDurations"];
|
|
33391
|
+
const _excluded = ["AudioLevelMeter", "AudioLevelTransformer", "BackingBar", "Chrome", "env", "Errors", "Events", "ExceptionCodes", "audioLevelSamplerFactory", "getStatsHelpers", "hasAudioOutputLevelStatCapability", "hasRemoteStreamsWithWebAudio", "interpretPeerConnectionError", "logging", "MuteButton", "NamePanel", "otError", "OTErrorClass", "OTHelpers", "StylableComponent", "SubscriberPeerConnection", "SubscribingState", "VideoDisabledIndicator", "AudioBlockedIndicator", "VideoUnsupportedIndicator", "watchFrameRate", "createSendMethod", "parseIceServers", "document", "WidgetView", "createAudioConnector", "ResizeObserverPolyfill", "MediaStream", "AMRStateDurations"];
|
|
33381
33392
|
const defaultWidgetView = (0, _widget_view.default)();
|
|
33382
33393
|
const EventsDefault = (0, _events2.default)();
|
|
33383
33394
|
const errorsDefault = _Errors.default;
|
|
@@ -33482,6 +33493,8 @@ function SubscriberFactory(_ref2) {
|
|
|
33482
33493
|
createAudioConnector = _ref3$createAudioConn === void 0 ? _audioConnector2.default : _ref3$createAudioConn,
|
|
33483
33494
|
_ref3$ResizeObserverP = _ref3.ResizeObserverPolyfill,
|
|
33484
33495
|
ResizeObserverPolyfill = _ref3$ResizeObserverP === void 0 ? _resizeObserverPolyfill.default : _ref3$ResizeObserverP,
|
|
33496
|
+
_ref3$MediaStream = _ref3.MediaStream,
|
|
33497
|
+
MediaStream = _ref3$MediaStream === void 0 ? (typeof window !== undefined ? window : global).MediaStream : _ref3$MediaStream,
|
|
33485
33498
|
AMRStateDurations = _ref3.AMRStateDurations,
|
|
33486
33499
|
deps = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded);
|
|
33487
33500
|
const BIND_VIDEO_DELAY_MAX = 30000;
|
|
@@ -33527,7 +33540,15 @@ function SubscriberFactory(_ref2) {
|
|
|
33527
33540
|
const webRTCStreams = {};
|
|
33528
33541
|
const hybridSessionTransitionStartTimes = {};
|
|
33529
33542
|
const _peerConnectionEvents = {};
|
|
33530
|
-
const
|
|
33543
|
+
const updateTrackOnStream = (mediaStream, oldTrack, newTrack) => {
|
|
33544
|
+
if (_exposedWebRTCStream) {
|
|
33545
|
+
(0, _updateTrackOnStream.default)(_exposedWebRTCStream, oldTrack, newTrack);
|
|
33546
|
+
}
|
|
33547
|
+
(0, _updateTrackOnStream.default)(mediaStream, oldTrack, newTrack);
|
|
33548
|
+
};
|
|
33549
|
+
const _audioConnector = createAudioConnector(webRTCStreams, {
|
|
33550
|
+
updateTrackOnStream
|
|
33551
|
+
});
|
|
33531
33552
|
|
|
33532
33553
|
/** @type {defaultWidgetView|null} */
|
|
33533
33554
|
let _widgetView;
|
|
@@ -33579,6 +33600,7 @@ function SubscriberFactory(_ref2) {
|
|
|
33579
33600
|
let _originalVideoTrack;
|
|
33580
33601
|
let _senderStats;
|
|
33581
33602
|
let _resizeObserver;
|
|
33603
|
+
let _exposedWebRTCStream;
|
|
33582
33604
|
|
|
33583
33605
|
// The audio stats watcher is only supported on chromium-based browsers that supports
|
|
33584
33606
|
// the standard version of the getStats API.
|
|
@@ -33652,6 +33674,10 @@ function SubscriberFactory(_ref2) {
|
|
|
33652
33674
|
isSubscriber: true
|
|
33653
33675
|
}));
|
|
33654
33676
|
};
|
|
33677
|
+
const syncUpMediaStreams = (targetStream, originalStream) => {
|
|
33678
|
+
(0, _updateTrackOnStream.default)(targetStream, targetStream.getAudioTracks()[0], originalStream.getAudioTracks()[0]);
|
|
33679
|
+
(0, _updateTrackOnStream.default)(targetStream, targetStream.getVideoTracks()[0], originalStream.getVideoTracks()[0]);
|
|
33680
|
+
};
|
|
33655
33681
|
const bindWebRTCStream = /*#__PURE__*/function () {
|
|
33656
33682
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(webRTCStream) {
|
|
33657
33683
|
var _stream2;
|
|
@@ -33665,6 +33691,10 @@ function SubscriberFactory(_ref2) {
|
|
|
33665
33691
|
}
|
|
33666
33692
|
return _context3.abrupt("return");
|
|
33667
33693
|
case 2:
|
|
33694
|
+
// Sync the track state of the exposed stream with our current stream
|
|
33695
|
+
if (_exposedWebRTCStream) {
|
|
33696
|
+
syncUpMediaStreams(_exposedWebRTCStream, webRTCStream);
|
|
33697
|
+
}
|
|
33668
33698
|
videoContainerOptions = {
|
|
33669
33699
|
error: onVideoError,
|
|
33670
33700
|
audioVolume: _audioVolume,
|
|
@@ -33672,28 +33702,28 @@ function SubscriberFactory(_ref2) {
|
|
|
33672
33702
|
}; // We want to catch any error in the prebuffering when transition to P2P.
|
|
33673
33703
|
// Otherwise, we ignore it.
|
|
33674
33704
|
throwIfBufferFails = _isAdaptiveEnabled && _activeSourceStreamId === 'P2P';
|
|
33675
|
-
_context3.prev =
|
|
33676
|
-
_context3.next =
|
|
33705
|
+
_context3.prev = 5;
|
|
33706
|
+
_context3.next = 8;
|
|
33677
33707
|
return _widgetView.bindVideo(webRTCStream, videoContainerOptions, throwIfBufferFails);
|
|
33678
|
-
case
|
|
33679
|
-
_context3.next =
|
|
33708
|
+
case 8:
|
|
33709
|
+
_context3.next = 16;
|
|
33680
33710
|
break;
|
|
33681
|
-
case
|
|
33682
|
-
_context3.prev =
|
|
33683
|
-
_context3.t0 = _context3["catch"](
|
|
33711
|
+
case 10:
|
|
33712
|
+
_context3.prev = 10;
|
|
33713
|
+
_context3.t0 = _context3["catch"](5);
|
|
33684
33714
|
if (!(_context3.t0 instanceof _cancel.CancellationError || _state.isDestroyed())) {
|
|
33685
|
-
_context3.next =
|
|
33715
|
+
_context3.next = 14;
|
|
33686
33716
|
break;
|
|
33687
33717
|
}
|
|
33688
33718
|
return _context3.abrupt("return");
|
|
33689
|
-
case
|
|
33719
|
+
case 14:
|
|
33690
33720
|
onVideoError(_context3.t0);
|
|
33691
33721
|
throw _context3.t0;
|
|
33692
|
-
case
|
|
33722
|
+
case 16:
|
|
33693
33723
|
case "end":
|
|
33694
33724
|
return _context3.stop();
|
|
33695
33725
|
}
|
|
33696
|
-
}, _callee3, null, [[
|
|
33726
|
+
}, _callee3, null, [[5, 10]]);
|
|
33697
33727
|
}));
|
|
33698
33728
|
return function bindWebRTCStream(_x3) {
|
|
33699
33729
|
return _ref6.apply(this, arguments);
|
|
@@ -34293,6 +34323,10 @@ function SubscriberFactory(_ref2) {
|
|
|
34293
34323
|
isSwappingStreams = Object.keys(webRTCStreams).length === 1;
|
|
34294
34324
|
sourceStreamId = peerConnection == null ? void 0 : peerConnection.getSourceStreamId();
|
|
34295
34325
|
_session2 = _session, sessionInfo = _session2.sessionInfo;
|
|
34326
|
+
if (!_exposedWebRTCStream) {
|
|
34327
|
+
_exposedWebRTCStream = new MediaStream(webRTCStream);
|
|
34328
|
+
_this.dispatchEvent(new Events.MediaStreamAvailable(_exposedWebRTCStream));
|
|
34329
|
+
}
|
|
34296
34330
|
_webRTCStream = webRTCStream;
|
|
34297
34331
|
|
|
34298
34332
|
// save a copy of the WebRTCStream
|
|
@@ -34302,21 +34336,21 @@ function SubscriberFactory(_ref2) {
|
|
|
34302
34336
|
logging.debug('OT.Subscriber.onRemoteStreamAdded with sourceStreamId', sourceStreamId);
|
|
34303
34337
|
_state.set('BindingRemoteStream');
|
|
34304
34338
|
if (!_videoMediaProcessorConnector) {
|
|
34305
|
-
_context7.next =
|
|
34339
|
+
_context7.next = 15;
|
|
34306
34340
|
break;
|
|
34307
34341
|
}
|
|
34308
34342
|
if (!_videoEnabled) {
|
|
34309
|
-
_context7.next =
|
|
34343
|
+
_context7.next = 14;
|
|
34310
34344
|
break;
|
|
34311
34345
|
}
|
|
34312
|
-
_context7.next =
|
|
34346
|
+
_context7.next = 12;
|
|
34313
34347
|
return applyVideoConnectorOnStream(sourceStreamId);
|
|
34314
|
-
case
|
|
34315
|
-
_context7.next =
|
|
34348
|
+
case 12:
|
|
34349
|
+
_context7.next = 15;
|
|
34316
34350
|
break;
|
|
34317
|
-
case 13:
|
|
34318
|
-
_videoMediaProcessorConnector.destroy();
|
|
34319
34351
|
case 14:
|
|
34352
|
+
_videoMediaProcessorConnector.destroy();
|
|
34353
|
+
case 15:
|
|
34320
34354
|
// Disable the audio/video, if needed
|
|
34321
34355
|
_this.subscribeToAudio(_isSubscribingToAudio);
|
|
34322
34356
|
if (!(_lastSubscribeToVideoReason === 'auto' && !_properties.subscribeToVideo)) {
|
|
@@ -34348,17 +34382,17 @@ function SubscriberFactory(_ref2) {
|
|
|
34348
34382
|
}
|
|
34349
34383
|
});
|
|
34350
34384
|
}
|
|
34351
|
-
_context7.prev =
|
|
34352
|
-
_context7.next =
|
|
34385
|
+
_context7.prev = 19;
|
|
34386
|
+
_context7.next = 22;
|
|
34353
34387
|
return bindWebRTCStream(_webRTCStream);
|
|
34354
|
-
case
|
|
34355
|
-
_context7.next =
|
|
34388
|
+
case 22:
|
|
34389
|
+
_context7.next = 33;
|
|
34356
34390
|
break;
|
|
34357
|
-
case
|
|
34358
|
-
_context7.prev =
|
|
34359
|
-
_context7.t0 = _context7["catch"](
|
|
34391
|
+
case 24:
|
|
34392
|
+
_context7.prev = 24;
|
|
34393
|
+
_context7.t0 = _context7["catch"](19);
|
|
34360
34394
|
if (!(0, _amrVideoBufferError.isAmrVideoBufferError)(_context7.t0)) {
|
|
34361
|
-
_context7.next =
|
|
34395
|
+
_context7.next = 32;
|
|
34362
34396
|
break;
|
|
34363
34397
|
}
|
|
34364
34398
|
logging.error(`OT.Subscriber: ${_context7.t0.message}`);
|
|
@@ -34371,17 +34405,17 @@ function SubscriberFactory(_ref2) {
|
|
|
34371
34405
|
socket.subscriberDestroy(_stream.id, _this.widgetId, _activeSourceStreamId);
|
|
34372
34406
|
}
|
|
34373
34407
|
return _context7.abrupt("return");
|
|
34374
|
-
case 31:
|
|
34375
|
-
throw _context7.t0;
|
|
34376
34408
|
case 32:
|
|
34409
|
+
throw _context7.t0;
|
|
34410
|
+
case 33:
|
|
34377
34411
|
startAudioStatsWatcher();
|
|
34378
34412
|
if (!_state.isDestroyed()) {
|
|
34379
|
-
_context7.next =
|
|
34413
|
+
_context7.next = 37;
|
|
34380
34414
|
break;
|
|
34381
34415
|
}
|
|
34382
34416
|
logging.error('Subscriber destroyed');
|
|
34383
34417
|
return _context7.abrupt("return");
|
|
34384
|
-
case
|
|
34418
|
+
case 37:
|
|
34385
34419
|
if (peerConnection && (typeof window !== undefined ? window : global).webkitMediaStream) {
|
|
34386
34420
|
// Enable any video streams that we previously disabled for OPENTOK-27112
|
|
34387
34421
|
peerConnection._getVideoTracks().forEach(track => {
|
|
@@ -34409,12 +34443,12 @@ function SubscriberFactory(_ref2) {
|
|
|
34409
34443
|
_widgetView.once('videoElementCreated', resolve);
|
|
34410
34444
|
_subscriber.once('destroyed', reject);
|
|
34411
34445
|
});
|
|
34412
|
-
_context7.next =
|
|
34446
|
+
_context7.next = 45;
|
|
34413
34447
|
return videoElementCreated;
|
|
34414
|
-
case
|
|
34415
|
-
_context7.next =
|
|
34448
|
+
case 45:
|
|
34449
|
+
_context7.next = 47;
|
|
34416
34450
|
return _pcConnected.promise;
|
|
34417
|
-
case
|
|
34451
|
+
case 47:
|
|
34418
34452
|
if (!isSwappingStreams) {
|
|
34419
34453
|
onLoaded();
|
|
34420
34454
|
} else {
|
|
@@ -34450,34 +34484,34 @@ function SubscriberFactory(_ref2) {
|
|
|
34450
34484
|
// Given an AMR transition, and an audio connector, we apply the connector for the new
|
|
34451
34485
|
// relayed stream and clear it for the routed stream.
|
|
34452
34486
|
if (!_isAdaptiveEnabled) {
|
|
34453
|
-
_context7.next =
|
|
34487
|
+
_context7.next = 63;
|
|
34454
34488
|
break;
|
|
34455
34489
|
}
|
|
34456
34490
|
amrState.completeTransitionTo(_activeSourceStreamId);
|
|
34457
34491
|
if (!(_isSubscribingToAudio && _audioConnector.audioMediaProcessorConnector)) {
|
|
34458
|
-
_context7.next =
|
|
34492
|
+
_context7.next = 63;
|
|
34459
34493
|
break;
|
|
34460
34494
|
}
|
|
34461
|
-
_context7.prev =
|
|
34462
|
-
_context7.next =
|
|
34495
|
+
_context7.prev = 54;
|
|
34496
|
+
_context7.next = 57;
|
|
34463
34497
|
return _audioConnector.applyAudioConnectorOnRoutedToRelayedTransition();
|
|
34464
|
-
case
|
|
34498
|
+
case 57:
|
|
34465
34499
|
logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success', {
|
|
34466
34500
|
message: 'Audio connector applied on routed to relayed transition.'
|
|
34467
34501
|
});
|
|
34468
|
-
_context7.next =
|
|
34502
|
+
_context7.next = 63;
|
|
34469
34503
|
break;
|
|
34470
|
-
case
|
|
34471
|
-
_context7.prev =
|
|
34472
|
-
_context7.t1 = _context7["catch"](
|
|
34504
|
+
case 60:
|
|
34505
|
+
_context7.prev = 60;
|
|
34506
|
+
_context7.t1 = _context7["catch"](54);
|
|
34473
34507
|
logAnalyticsEvent('setAudioMediaProcessorConnector', 'Failure', {
|
|
34474
34508
|
message: _context7.t1.message
|
|
34475
34509
|
});
|
|
34476
|
-
case
|
|
34510
|
+
case 63:
|
|
34477
34511
|
case "end":
|
|
34478
34512
|
return _context7.stop();
|
|
34479
34513
|
}
|
|
34480
|
-
}, _callee7, null, [[
|
|
34514
|
+
}, _callee7, null, [[19, 24], [54, 60]]);
|
|
34481
34515
|
}));
|
|
34482
34516
|
return function onRemoteStreamAdded(_x9, _x10) {
|
|
34483
34517
|
return _ref15.apply(this, arguments);
|
|
@@ -35043,8 +35077,9 @@ function SubscriberFactory(_ref2) {
|
|
|
35043
35077
|
_context15.next = 29;
|
|
35044
35078
|
return createAudioLevelSampler(peerConnection);
|
|
35045
35079
|
case 29:
|
|
35080
|
+
_audioLevelSampler.webRTCStream(_webRTCStream);
|
|
35046
35081
|
logRelayedToRoutedTransition('Success');
|
|
35047
|
-
case
|
|
35082
|
+
case 31:
|
|
35048
35083
|
case "end":
|
|
35049
35084
|
return _context15.stop();
|
|
35050
35085
|
}
|
|
@@ -36658,7 +36693,7 @@ function SubscriberFactory(_ref2) {
|
|
|
36658
36693
|
return _videoMediaProcessorConnector.setTrack(_originalVideoTrack);
|
|
36659
36694
|
case 10:
|
|
36660
36695
|
filteredVideoTrack = _context27.sent;
|
|
36661
|
-
(
|
|
36696
|
+
updateTrackOnStream(_webRTCStream, _originalVideoTrack, filteredVideoTrack);
|
|
36662
36697
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
|
|
36663
36698
|
_context27.next = 20;
|
|
36664
36699
|
break;
|
|
@@ -36688,7 +36723,7 @@ function SubscriberFactory(_ref2) {
|
|
|
36688
36723
|
// We need to switch to the original track so we can transform it later when resetting the connector.
|
|
36689
36724
|
const _webRTCStream$getVide2 = _webRTCStream.getVideoTracks(),
|
|
36690
36725
|
filteredVideoTrack = _webRTCStream$getVide2[0];
|
|
36691
|
-
(
|
|
36726
|
+
updateTrackOnStream(_webRTCStream, filteredVideoTrack, _originalVideoTrack);
|
|
36692
36727
|
logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
|
|
36693
36728
|
message: 'reset the video track'
|
|
36694
36729
|
});
|
|
@@ -65021,7 +65056,7 @@ function SessionFactory(deps) {
|
|
|
65021
65056
|
* @method #publish
|
|
65022
65057
|
* @memberOf Session
|
|
65023
65058
|
*/
|
|
65024
|
-
this.publish =
|
|
65059
|
+
this.publish = (publisher, properties, completionHandler) => {
|
|
65025
65060
|
if (typeof publisher === 'function') {
|
|
65026
65061
|
completionHandler = publisher;
|
|
65027
65062
|
publisher = undefined;
|
|
@@ -65059,11 +65094,15 @@ function SessionFactory(deps) {
|
|
|
65059
65094
|
return null;
|
|
65060
65095
|
}
|
|
65061
65096
|
|
|
65062
|
-
// If the user has passed in an ID
|
|
65063
|
-
|
|
65064
|
-
|
|
65065
|
-
|
|
65066
|
-
|
|
65097
|
+
// If the user has passed in an ID or an element then we create a new publisher.
|
|
65098
|
+
const shouldInitPublisher = !publisher || typeof publisher === 'string' || OTHelpers.isElementNode(publisher);
|
|
65099
|
+
// If publisher is an instance of Publisher we use that Publisher.
|
|
65100
|
+
const shouldUsePublisher = publisher instanceof Publisher;
|
|
65101
|
+
if (!shouldInitPublisher && !shouldUsePublisher) {
|
|
65102
|
+
dispatchOTError(otError(errors.INVALID_PARAMETER, new Error('Session.publish :: First parameter passed in is neither a ' + 'string nor an instance of the Publisher'), ExceptionCodes.UNABLE_TO_PUBLISH), completionHandler);
|
|
65103
|
+
return undefined;
|
|
65104
|
+
}
|
|
65105
|
+
if (shouldUsePublisher) {
|
|
65067
65106
|
// If the publisher already has a session attached to it we can
|
|
65068
65107
|
if ('session' in publisher && publisher.session && 'sessionId' in publisher.session) {
|
|
65069
65108
|
// send a warning message that we can't publish again.
|
|
@@ -65072,26 +65111,23 @@ function SessionFactory(deps) {
|
|
|
65072
65111
|
} else {
|
|
65073
65112
|
_logging.warn(`Cannot publish ${publisher.guid()} publisher already attached to ${publisher.session.sessionId}. Please call session.unpublish(publisher) first.`);
|
|
65074
65113
|
}
|
|
65114
|
+
completionHandler(null, publisher);
|
|
65115
|
+
return publisher;
|
|
65075
65116
|
}
|
|
65076
|
-
} else {
|
|
65077
|
-
|
|
65078
|
-
|
|
65117
|
+
} else if (shouldInitPublisher) {
|
|
65118
|
+
// Initiate a new Publisher with the new session credentials
|
|
65119
|
+
publisher = initPublisher(publisher, properties);
|
|
65079
65120
|
}
|
|
65080
65121
|
if (_muteOnEntry) {
|
|
65081
65122
|
publisher._.forceMuteAudio();
|
|
65082
65123
|
}
|
|
65083
65124
|
|
|
65084
65125
|
// Add publisher reference to the session
|
|
65085
|
-
publisher._.publishToSession(this, analytics).
|
|
65126
|
+
publisher._.publishToSession(this, analytics).then(() => completionHandler(null, publisher), err => {
|
|
65086
65127
|
err.message = `Session.publish :: ${err.message}`;
|
|
65087
65128
|
_logging.error(err.code, err.message);
|
|
65088
|
-
|
|
65089
|
-
})
|
|
65090
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
65091
|
-
args[_key3] = arguments[_key3];
|
|
65092
|
-
}
|
|
65093
|
-
return completionHandler(null, ...args);
|
|
65094
|
-
}, err => completionHandler(err));
|
|
65129
|
+
completionHandler(err);
|
|
65130
|
+
});
|
|
65095
65131
|
|
|
65096
65132
|
// return the embed publisher
|
|
65097
65133
|
return publisher;
|
|
@@ -66223,8 +66259,8 @@ function SessionFactory(deps) {
|
|
|
66223
66259
|
_completion(error);
|
|
66224
66260
|
return;
|
|
66225
66261
|
}
|
|
66226
|
-
for (var
|
|
66227
|
-
args[
|
|
66262
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
66263
|
+
args[_key3 - 1] = arguments[_key3];
|
|
66228
66264
|
}
|
|
66229
66265
|
_completion(error, ...args);
|
|
66230
66266
|
}, this.logEvent);
|
|
@@ -66336,8 +66372,8 @@ function SessionFactory(deps) {
|
|
|
66336
66372
|
if (err) {
|
|
66337
66373
|
dispatchOTError(otError(errors.INVALID_PARAMETER, new Error(invalidParameterErrorMsg), ExceptionCodes.INVALID_PARAMETER), completionHandler);
|
|
66338
66374
|
} else if (completionHandler && (0, _isFunction.default)(completionHandler)) {
|
|
66339
|
-
for (var
|
|
66340
|
-
args[
|
|
66375
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
66376
|
+
args[_key4 - 1] = arguments[_key4];
|
|
66341
66377
|
}
|
|
66342
66378
|
completionHandler(err, ...args);
|
|
66343
66379
|
}
|
|
@@ -66857,7 +66893,7 @@ function SessionFactory(deps) {
|
|
|
66857
66893
|
/**
|
|
66858
66894
|
* The client has disconnected from the session. This event may be dispatched asynchronously
|
|
66859
66895
|
* in response to a successful call to the <code>disconnect()</code> method of the Session object.
|
|
66860
|
-
* The event may also be
|
|
66896
|
+
* The event may also be dispatched if a session connection is lost inadvertantly, as in the case
|
|
66861
66897
|
* of a lost network connection.
|
|
66862
66898
|
* <p>
|
|
66863
66899
|
* The default behavior is that all Subscriber objects are unsubscribed and removed from the
|
|
@@ -94219,6 +94255,16 @@ var _default = _ref => {
|
|
|
94219
94255
|
subscriber.dispatchEvent(new Events.AudioLevelUpdatedEvent(loudness));
|
|
94220
94256
|
}
|
|
94221
94257
|
});
|
|
94258
|
+
const audioLevelUpdatedAdded = () => audioLevelRunner.start();
|
|
94259
|
+
const subscriberDestroyed = () => audioLevelRunner.stop();
|
|
94260
|
+
const addListeners = () => {
|
|
94261
|
+
subscriber.on('audioLevelUpdated:added', audioLevelUpdatedAdded);
|
|
94262
|
+
subscriber.once(_eventNames.default.SUBSCRIBER_DESTROYED, subscriberDestroyed);
|
|
94263
|
+
};
|
|
94264
|
+
const removeListeners = () => {
|
|
94265
|
+
subscriber.off('audioLevelUpdated:added', audioLevelUpdatedAdded);
|
|
94266
|
+
subscriber.off(_eventNames.default.SUBSCRIBER_DESTROYED, subscriberDestroyed);
|
|
94267
|
+
};
|
|
94222
94268
|
Object.defineProperty(subscriber, 'loudness', {
|
|
94223
94269
|
get() {
|
|
94224
94270
|
audioLevelRunner.start();
|
|
@@ -94233,16 +94279,14 @@ var _default = _ref => {
|
|
|
94233
94279
|
if (subscriber.listenerCount(_eventNames.default.AUDIO_LEVEL_UPDATED)) {
|
|
94234
94280
|
audioLevelRunner.start();
|
|
94235
94281
|
}
|
|
94236
|
-
|
|
94237
|
-
audioLevelRunner.start();
|
|
94238
|
-
});
|
|
94239
|
-
subscriber.once(_eventNames.default.SUBSCRIBER_DESTROYED, () => {
|
|
94240
|
-
audioLevelRunner.stop();
|
|
94241
|
-
});
|
|
94282
|
+
addListeners();
|
|
94242
94283
|
return {
|
|
94243
94284
|
destroy() {
|
|
94244
94285
|
audioLevelSampler.destroy();
|
|
94245
94286
|
audioLevelRunner.stop();
|
|
94287
|
+
removeListeners();
|
|
94288
|
+
// eslint-disable-next-line no-param-reassign
|
|
94289
|
+
subscriber = undefined;
|
|
94246
94290
|
}
|
|
94247
94291
|
};
|
|
94248
94292
|
};
|
|
@@ -103306,6 +103350,8 @@ let SinglePeerConnectionController = /*#__PURE__*/function () {
|
|
|
103306
103350
|
};
|
|
103307
103351
|
_proto._parseOptions = function _parseOptions(options) {
|
|
103308
103352
|
return Object.assign({}, options, {
|
|
103353
|
+
// Create only one RTCDtlsTransport
|
|
103354
|
+
bundlePolicy: 'max-bundle',
|
|
103309
103355
|
// We always remove unused codecs after iceRestart in SPC
|
|
103310
103356
|
removeUnusedCodecs: true,
|
|
103311
103357
|
sendMessage: (type, payload) => {
|
|
@@ -103457,7 +103503,7 @@ let SinglePeerConnectionController = /*#__PURE__*/function () {
|
|
|
103457
103503
|
|
|
103458
103504
|
// Singleton to make sure we are using only one PC when SPC. If SPC, we will add Subscriber
|
|
103459
103505
|
// specific options to handle analytics and negotiation per Subscriber. This will take care
|
|
103460
|
-
// to send the answer back to Rumor by its respective
|
|
103506
|
+
// to send the answer back to Rumor by its respective Subscriber and not multiple answers.
|
|
103461
103507
|
// It will instantiate a new regular PC for all other cases.
|
|
103462
103508
|
;
|
|
103463
103509
|
_proto.getPeerConnection = function getPeerConnection(opt, subscriberPc) {
|