@opentok/client 2.31.0-alpha.59 → 2.31.0-alpha.60
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.js +33 -83
- 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.31.0
|
|
2
|
+
* @license OpenTok.js 2.31.0 d7e6af97f
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2010-2025 TokBox, Inc.
|
|
5
5
|
* Subject to the applicable Software Development Kit (SDK) License Agreement:
|
|
6
6
|
* https://www.vonage.com/legal/communications-apis/terms-of-use/
|
|
7
7
|
*
|
|
8
|
-
* Date: Fri, 03 Oct 2025
|
|
8
|
+
* Date: Fri, 03 Oct 2025 15:12:43 GMT
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -5574,43 +5574,6 @@ SDPHelpers.disableTrack = mLine => {
|
|
|
5574
5574
|
transport = _SDPHelpers$parseMLin.transport;
|
|
5575
5575
|
return `${mediaType} 0 ${transport}`;
|
|
5576
5576
|
};
|
|
5577
|
-
SDPHelpers.setMediaDirection = (_sdpLines, direction) => {
|
|
5578
|
-
const isValidDirection = Object.values(_mediaDirection.default).includes(direction);
|
|
5579
|
-
if (!isValidDirection) {
|
|
5580
|
-
return _sdpLines;
|
|
5581
|
-
}
|
|
5582
|
-
const sdpLines = _sdpLines.slice();
|
|
5583
|
-
const directionIndex = sdpLines.findIndex(line => SDPHelpers.includesAny(line, SDPHelpers.patterns.direction));
|
|
5584
|
-
if (directionIndex === -1) {
|
|
5585
|
-
// Oops, like like there's no direction attribute
|
|
5586
|
-
return sdpLines;
|
|
5587
|
-
}
|
|
5588
|
-
sdpLines[directionIndex] = `a=${direction}`;
|
|
5589
|
-
return sdpLines;
|
|
5590
|
-
};
|
|
5591
|
-
SDPHelpers.disableTrackSection = section => {
|
|
5592
|
-
const mid = section.mid,
|
|
5593
|
-
sdp = section.sdp;
|
|
5594
|
-
|
|
5595
|
-
// Remove lines for address, rtcp, rsize, ssrc and msid
|
|
5596
|
-
let disabledTrackSdp = sdp.filter(line => {
|
|
5597
|
-
const _SDPHelpers$patterns = SDPHelpers.patterns,
|
|
5598
|
-
address = _SDPHelpers$patterns.address,
|
|
5599
|
-
rtcp = _SDPHelpers$patterns.rtcp,
|
|
5600
|
-
rsize = _SDPHelpers$patterns.rsize,
|
|
5601
|
-
ssrc = _SDPHelpers$patterns.ssrc,
|
|
5602
|
-
msid = _SDPHelpers$patterns.msid;
|
|
5603
|
-
return !SDPHelpers.includesAny(line, [address, rtcp, rsize, ssrc, msid]);
|
|
5604
|
-
});
|
|
5605
|
-
|
|
5606
|
-
// We always disable the track on the first line
|
|
5607
|
-
disabledTrackSdp[0] = SDPHelpers.disableTrack(sdp[0]);
|
|
5608
|
-
disabledTrackSdp = SDPHelpers.setMediaDirection(disabledTrackSdp, _mediaDirection.default.INACTIVE);
|
|
5609
|
-
return {
|
|
5610
|
-
mid,
|
|
5611
|
-
sdp: disabledTrackSdp
|
|
5612
|
-
};
|
|
5613
|
-
};
|
|
5614
5577
|
SDPHelpers.isDisabledMediaSection = _ref2 => {
|
|
5615
5578
|
let section = _ref2[0];
|
|
5616
5579
|
return /^m=(?:video|audio) 0 RTP\/SAVPF 0/.test(section);
|
|
@@ -5621,27 +5584,6 @@ SDPHelpers.getDisabledSectionForMid = mid => {
|
|
|
5621
5584
|
const disabledSection = [`m=${mediaType} 0 RTP/SAVPF 0`];
|
|
5622
5585
|
return disabledSection;
|
|
5623
5586
|
};
|
|
5624
|
-
|
|
5625
|
-
/**
|
|
5626
|
-
* Disable media sections that are not present in track array
|
|
5627
|
-
* @param {Array<string>} tracks - an array of active tracks mids e.g. ['0a', '1v']
|
|
5628
|
-
* @param {Array<string>} sections - an array of media section line arrays
|
|
5629
|
-
* e.g. [
|
|
5630
|
-
* ['m=audio 52265 RTP/SAVPF 98', 'c=IN IP4 54.197.248.203', ...etc],
|
|
5631
|
-
* ['m=video 52265 RTP/SAVPF 97', 'c=IN IP4 54.197.248.203', ...etc]
|
|
5632
|
-
* ];
|
|
5633
|
-
* @returns array of media section line arrays with specified track sections disabled
|
|
5634
|
-
*/
|
|
5635
|
-
SDPHelpers.disableTrackSections = (tracks, sections) => sections.map(section => {
|
|
5636
|
-
const _SDPHelpers$getTrackM = SDPHelpers.getTrackMids(section),
|
|
5637
|
-
mid = _SDPHelpers$getTrackM[0];
|
|
5638
|
-
if (!mid || tracks.includes(mid)) {
|
|
5639
|
-
// If mid is null the section has been already disabled.
|
|
5640
|
-
// If mid is a current enabled track, we don't disable it.
|
|
5641
|
-
return section;
|
|
5642
|
-
}
|
|
5643
|
-
return SDPHelpers.getDisabledSectionForMid(mid);
|
|
5644
|
-
});
|
|
5645
5587
|
SDPHelpers.getEnabledTracks = sdpLines => {
|
|
5646
5588
|
const bundleLine = SDPHelpers.getBundleLine(sdpLines);
|
|
5647
5589
|
|
|
@@ -8605,7 +8547,7 @@ function staticConfigFactory(_temp) {
|
|
|
8605
8547
|
_ref$axios = _ref.axios,
|
|
8606
8548
|
axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
|
|
8607
8549
|
_ref$properties = _ref.properties,
|
|
8608
|
-
properties = _ref$properties === void 0 ? {"version":"v2.31.0","buildHash":"
|
|
8550
|
+
properties = _ref$properties === void 0 ? {"version":"v2.31.0","buildHash":"d7e6af97f","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;
|
|
8609
8551
|
/** @type builtInConfig */
|
|
8610
8552
|
const builtInConfig = (0, _cloneDeep.default)(properties);
|
|
8611
8553
|
/**
|
|
@@ -69885,7 +69827,7 @@ const _SDPHelpers$MediaDire = _sdp_helpers.default.MediaDirection,
|
|
|
69885
69827
|
INACTIVE = _SDPHelpers$MediaDire.INACTIVE;
|
|
69886
69828
|
const changeMediaDirection = /*#__PURE__*/function () {
|
|
69887
69829
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(peerConnection, direction) {
|
|
69888
|
-
var offer, sdp
|
|
69830
|
+
var transceivers, canChangeTransceiversDirection, currentDirection, offer, sdp;
|
|
69889
69831
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
69890
69832
|
while (1) switch (_context.prev = _context.next) {
|
|
69891
69833
|
case 0:
|
|
@@ -69895,20 +69837,40 @@ const changeMediaDirection = /*#__PURE__*/function () {
|
|
|
69895
69837
|
}
|
|
69896
69838
|
return _context.abrupt("return");
|
|
69897
69839
|
case 2:
|
|
69898
|
-
|
|
69840
|
+
transceivers = peerConnection.getTransceivers();
|
|
69841
|
+
canChangeTransceiversDirection = transceivers.some(transceiver => transceiver.direction);
|
|
69842
|
+
if (canChangeTransceiversDirection) {
|
|
69843
|
+
currentDirection = direction === RECVONLY ? INACTIVE : RECVONLY;
|
|
69844
|
+
transceivers.filter(transceiver => {
|
|
69845
|
+
var _transceiver$sender, _transceiver$sender$t;
|
|
69846
|
+
return ((_transceiver$sender = transceiver.sender) == null ? void 0 : (_transceiver$sender$t = _transceiver$sender.track) == null ? void 0 : _transceiver$sender$t.kind) === 'video' && transceiver.currentDirection === currentDirection && transceiver.direction !== direction;
|
|
69847
|
+
}).forEach(transceiver => {
|
|
69848
|
+
try {
|
|
69849
|
+
// eslint-disable-next-line no-param-reassign
|
|
69850
|
+
transceiver.direction = direction;
|
|
69851
|
+
} catch (e) {
|
|
69852
|
+
canChangeTransceiversDirection = false;
|
|
69853
|
+
}
|
|
69854
|
+
});
|
|
69855
|
+
}
|
|
69856
|
+
if (canChangeTransceiversDirection) {
|
|
69857
|
+
_context.next = 13;
|
|
69858
|
+
break;
|
|
69859
|
+
}
|
|
69860
|
+
_context.next = 8;
|
|
69899
69861
|
return peerConnection.createOffer();
|
|
69900
|
-
case
|
|
69862
|
+
case 8:
|
|
69901
69863
|
offer = _context.sent;
|
|
69902
|
-
_context.next =
|
|
69864
|
+
_context.next = 11;
|
|
69903
69865
|
return peerConnection.setLocalDescription(offer);
|
|
69904
|
-
case
|
|
69905
|
-
sdp = peerConnection.remoteDescription.sdp;
|
|
69906
|
-
newSdp = _sdp_helpers.default.changeMediaDirection(sdp, direction);
|
|
69866
|
+
case 11:
|
|
69867
|
+
sdp = peerConnection.remoteDescription.sdp;
|
|
69907
69868
|
peerConnection.setRemoteDescription({
|
|
69908
69869
|
type: peerConnection.remoteDescription.type,
|
|
69909
|
-
|
|
69870
|
+
// replaces the 'a=recvonly' lines to 'a=inactive' or viceversa, depending on active.
|
|
69871
|
+
sdp: _sdp_helpers.default.changeMediaDirection(sdp, direction)
|
|
69910
69872
|
});
|
|
69911
|
-
case
|
|
69873
|
+
case 13:
|
|
69912
69874
|
case "end":
|
|
69913
69875
|
return _context.stop();
|
|
69914
69876
|
}
|
|
@@ -69920,7 +69882,7 @@ const changeMediaDirection = /*#__PURE__*/function () {
|
|
|
69920
69882
|
}();
|
|
69921
69883
|
|
|
69922
69884
|
/**
|
|
69923
|
-
* Changes the RTP media direction
|
|
69885
|
+
* Changes the RTP media direction
|
|
69924
69886
|
* @param {Object} peerConnection - the peer connection to apply the change
|
|
69925
69887
|
* @param {('recvonly' | 'inactive')} direction - The new direction that could be recvonly or
|
|
69926
69888
|
* inactive. If it's inactive, then the peer connection will stop sending RTP media.
|
|
@@ -84610,18 +84572,6 @@ const createPeerConnectionSDP = function createPeerConnectionSDP(deps) {
|
|
|
84610
84572
|
updateParsedSdp(sdp) {
|
|
84611
84573
|
Object.assign(this.sdp, sdp);
|
|
84612
84574
|
},
|
|
84613
|
-
updateSdpWithNewOffer(sdp) {
|
|
84614
|
-
const parsedSdp = sdpHelpers.updateSDPWithNewOffer({
|
|
84615
|
-
mediaSections: this.sdp.mediaSections,
|
|
84616
|
-
headers: this.sdp.headers,
|
|
84617
|
-
version: this.sdp.version
|
|
84618
|
-
}, sdp.sdp);
|
|
84619
|
-
Object.assign(this.sdp, parsedSdp);
|
|
84620
|
-
},
|
|
84621
|
-
setOfferAndCreateAnswer(offer) {
|
|
84622
|
-
this.updateSdpWithNewOffer(offer);
|
|
84623
|
-
return sdpHelpers.createSDP(this.sdp.headers, this.sdp.mediaSections);
|
|
84624
|
-
},
|
|
84625
84575
|
createSdp() {
|
|
84626
84576
|
return sdpHelpers.createSDP(this.sdp.headers, this.sdp.mediaSections);
|
|
84627
84577
|
},
|