@vonage/client-sdk-video 2.35.0-alpha.37 → 2.35.0-alpha.39
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 +9 -3
- package/dist/js/opentok.js +285 -186
- 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.d.ts
CHANGED
|
@@ -472,9 +472,15 @@ declare namespace OT {
|
|
|
472
472
|
applyAudioFilter(audioFilter: AudioFilter): Promise<void>;
|
|
473
473
|
clearAudioFilter(): Promise<void>;
|
|
474
474
|
getAudioFilter(): AudioFilter | null;
|
|
475
|
-
publishAudio
|
|
476
|
-
|
|
477
|
-
|
|
475
|
+
publishAudio: {
|
|
476
|
+
(value: boolean): void;
|
|
477
|
+
promise: (value: boolean) => Promise<void>;
|
|
478
|
+
}
|
|
479
|
+
publishVideo: {
|
|
480
|
+
(value: boolean, callback?: (error?: OTError) => void): void;
|
|
481
|
+
promise: (value: boolean) => Promise<void>;
|
|
482
|
+
}
|
|
483
|
+
publishCaptions(value: boolean): Promise<void>;
|
|
478
484
|
cycleVideo(): Promise<{ deviceId: string }>;
|
|
479
485
|
setAudioSource(audioSource:string | MediaStreamTrack): Promise<undefined>;
|
|
480
486
|
getAudioSource(): MediaStreamTrack;
|
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 bf65e73
|
|
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: Fri, 29 May 2026 07:48:09 GMT
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -31880,7 +31880,7 @@ if (isWorker()) {
|
|
|
31880
31880
|
initWorker();
|
|
31881
31881
|
}
|
|
31882
31882
|
var Module = (() => {
|
|
31883
|
-
var _scriptDir = "file:///Users/ec2-user/
|
|
31883
|
+
var _scriptDir = "file:///Users/ec2-user/actions-runner/webrtc-js/_work/webrtc-js/webrtc-js/node_modules/@vonage/js-sframe/dist/js-sframe.es.js";
|
|
31884
31884
|
return function(Module2) {
|
|
31885
31885
|
Module2 = Module2 || {};
|
|
31886
31886
|
var Module2 = typeof Module2 != "undefined" ? Module2 : {};
|
|
@@ -41920,7 +41920,7 @@ function staticConfigFactory(_temp) {
|
|
|
41920
41920
|
_ref$axios = _ref.axios,
|
|
41921
41921
|
axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
|
|
41922
41922
|
_ref$properties = _ref.properties,
|
|
41923
|
-
properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"
|
|
41923
|
+
properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"bf65e73","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com","vonageApiURL":""} : _ref$properties;
|
|
41924
41924
|
/** @type builtInConfig */
|
|
41925
41925
|
const builtInConfig = (0, _cloneDeep.default)(properties);
|
|
41926
41926
|
/**
|
|
@@ -45680,172 +45680,201 @@ function PublisherFactory(_ref) {
|
|
|
45680
45680
|
this.destroy();
|
|
45681
45681
|
}, this.session.MIGRATION_TIMEOUT);
|
|
45682
45682
|
};
|
|
45683
|
-
|
|
45684
|
-
|
|
45685
|
-
|
|
45686
|
-
reset();
|
|
45687
|
-
}
|
|
45688
|
-
state.set('GetUserMedia');
|
|
45689
|
-
if (properties.style) {
|
|
45690
|
-
this.setStyle(properties.style, null, true);
|
|
45683
|
+
const publishWithCallback = function publishWithCallback(targetElement, callback) {
|
|
45684
|
+
if (callback === void 0) {
|
|
45685
|
+
callback = () => {};
|
|
45691
45686
|
}
|
|
45692
|
-
|
|
45693
|
-
|
|
45694
|
-
|
|
45695
|
-
|
|
45696
|
-
|
|
45697
|
-
|
|
45698
|
-
|
|
45699
|
-
|
|
45700
|
-
|
|
45701
|
-
|
|
45702
|
-
|
|
45703
|
-
|
|
45704
|
-
|
|
45705
|
-
|
|
45706
|
-
(
|
|
45707
|
-
|
|
45708
|
-
|
|
45709
|
-
|
|
45710
|
-
|
|
45711
|
-
|
|
45712
|
-
|
|
45713
|
-
|
|
45714
|
-
|
|
45715
|
-
|
|
45716
|
-
|
|
45717
|
-
|
|
45718
|
-
|
|
45719
|
-
widgetView.on('videoDimensionsChanged', (oldValue, newValue) => {
|
|
45720
|
-
// Ignore this event since there is no video.
|
|
45721
|
-
if (!properties.publishVideo) {
|
|
45722
|
-
return;
|
|
45723
|
-
}
|
|
45724
|
-
if (this.stream) {
|
|
45725
|
-
this.stream.setVideoDimensions(newValue.width, newValue.height);
|
|
45726
|
-
}
|
|
45727
|
-
this.dispatchEvent(new Events.VideoDimensionsChangedEvent(this, oldValue, newValue));
|
|
45728
|
-
});
|
|
45729
|
-
widgetView.on('mediaStopped', track => {
|
|
45730
|
-
const event = new Events.MediaStoppedEvent(this, track);
|
|
45731
|
-
|
|
45732
|
-
// When we have a disabled and transformed media track, we don't dispatch the event since
|
|
45733
|
-
// it is not a media source stop. This is the case when we call publishVideo(false) or
|
|
45734
|
-
// cycleVideo(), where the transformed track is stopped.
|
|
45735
|
-
const isDisabledTransformedTrack = (track == null ? void 0 : track.readyState) === 'ended' &&
|
|
45736
|
-
// Only transformed tracks have the writable property.
|
|
45737
|
-
// See: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackGenerator/writable
|
|
45738
|
-
!!(track != null && track.writable);
|
|
45739
|
-
if (!isDisabledTransformedTrack) {
|
|
45740
|
-
this.dispatchEvent(event);
|
|
45687
|
+
logging.debug('OT.Publisher: publish');
|
|
45688
|
+
try {
|
|
45689
|
+
if (state.isAttemptingToPublish() || state.isPublishing()) {
|
|
45690
|
+
reset();
|
|
45691
|
+
}
|
|
45692
|
+
state.set('GetUserMedia');
|
|
45693
|
+
if (properties.style) {
|
|
45694
|
+
_this.setStyle(properties.style, null, true);
|
|
45695
|
+
}
|
|
45696
|
+
properties.classNames = 'OT_root OT_publisher';
|
|
45697
|
+
|
|
45698
|
+
// Defer actually creating the publisher DOM nodes until we know
|
|
45699
|
+
// the DOM is actually loaded.
|
|
45700
|
+
EnvironmentLoader.onLoad(() => {
|
|
45701
|
+
logging.debug('OT.Publisher: publish: environment loaded');
|
|
45702
|
+
// @note If ever replacing the widgetView with a new one elsewhere, you'll need to be
|
|
45703
|
+
// mindful that audioLevelBehaviour has a reference to this one, and it will need to be
|
|
45704
|
+
// updated accordingly.
|
|
45705
|
+
// widgetView = new WidgetView(targetElement, properties);
|
|
45706
|
+
widgetView = new WidgetView(targetElement, Object.assign({}, properties, {
|
|
45707
|
+
widgetType: 'publisher'
|
|
45708
|
+
}));
|
|
45709
|
+
if (shouldAllowAudio) {
|
|
45710
|
+
(0, _audioLevelBehaviour.default)({
|
|
45711
|
+
publisher: _this,
|
|
45712
|
+
widgetView
|
|
45713
|
+
});
|
|
45741
45714
|
}
|
|
45742
|
-
|
|
45743
|
-
|
|
45715
|
+
widgetView.on('error', err => {
|
|
45716
|
+
onVideoError(err);
|
|
45717
|
+
});
|
|
45718
|
+
_this.id = widgetView.domId();
|
|
45719
|
+
_this.element = widgetView.domElement;
|
|
45720
|
+
if (_this.element && chromeMixin) {
|
|
45721
|
+
// Only create the chrome if we have an element to insert it into
|
|
45722
|
+
// for insertDefautlUI:false we don't create the chrome
|
|
45723
|
+
chromeMixin.init(widgetView);
|
|
45744
45724
|
}
|
|
45745
|
-
|
|
45746
|
-
|
|
45747
|
-
|
|
45748
|
-
|
|
45749
|
-
|
|
45750
|
-
|
|
45751
|
-
|
|
45752
|
-
|
|
45725
|
+
widgetView.on('videoDimensionsChanged', (oldValue, newValue) => {
|
|
45726
|
+
// Ignore this event since there is no video.
|
|
45727
|
+
if (!properties.publishVideo) {
|
|
45728
|
+
return;
|
|
45729
|
+
}
|
|
45730
|
+
if (_this.stream) {
|
|
45731
|
+
_this.stream.setVideoDimensions(newValue.width, newValue.height);
|
|
45732
|
+
}
|
|
45733
|
+
_this.dispatchEvent(new Events.VideoDimensionsChangedEvent(_this, oldValue, newValue));
|
|
45734
|
+
});
|
|
45735
|
+
widgetView.on('mediaStopped', track => {
|
|
45736
|
+
const event = new Events.MediaStoppedEvent(_this, track);
|
|
45737
|
+
|
|
45738
|
+
// When we have a disabled and transformed media track, we don't dispatch the event since
|
|
45739
|
+
// it is not a media source stop. This is the case when we call publishVideo(false) or
|
|
45740
|
+
// cycleVideo(), where the transformed track is stopped.
|
|
45741
|
+
const isDisabledTransformedTrack = (track == null ? void 0 : track.readyState) === 'ended' &&
|
|
45742
|
+
// Only transformed tracks have the writable property.
|
|
45743
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackGenerator/writable
|
|
45744
|
+
!!(track != null && track.writable);
|
|
45745
|
+
if (!isDisabledTransformedTrack) {
|
|
45746
|
+
_this.dispatchEvent(event);
|
|
45747
|
+
}
|
|
45748
|
+
if (event.isDefaultPrevented()) {
|
|
45749
|
+
return;
|
|
45750
|
+
}
|
|
45751
|
+
if (track) {
|
|
45752
|
+
const kind = String(track.kind).toLowerCase();
|
|
45753
|
+
// If we are publishing this kind when the track stops then
|
|
45754
|
+
// make sure we start publishing again if we switch to a new track
|
|
45755
|
+
if (kind === 'audio') {
|
|
45756
|
+
updateAudio();
|
|
45757
|
+
} else if (kind === 'video') {
|
|
45758
|
+
updateVideo();
|
|
45759
|
+
} else {
|
|
45760
|
+
logging.warn(`Track with invalid kind has ended: ${track.kind}`);
|
|
45761
|
+
}
|
|
45762
|
+
logAnalyticsEvent('mediaStopped', 'Event', {
|
|
45763
|
+
kind
|
|
45764
|
+
});
|
|
45765
|
+
return;
|
|
45766
|
+
}
|
|
45767
|
+
if (_this.session) {
|
|
45768
|
+
_this._.unpublishFromSession(_this.session, 'mediaStopped');
|
|
45753
45769
|
} else {
|
|
45754
|
-
|
|
45770
|
+
_this.destroy('mediaStopped');
|
|
45755
45771
|
}
|
|
45756
|
-
|
|
45757
|
-
|
|
45758
|
-
|
|
45759
|
-
|
|
45760
|
-
|
|
45761
|
-
|
|
45762
|
-
|
|
45763
|
-
|
|
45764
|
-
|
|
45765
|
-
}
|
|
45766
|
-
|
|
45767
|
-
|
|
45768
|
-
|
|
45769
|
-
|
|
45770
|
-
|
|
45771
|
-
|
|
45772
|
-
|
|
45773
|
-
|
|
45774
|
-
|
|
45775
|
-
|
|
45776
|
-
|
|
45777
|
-
|
|
45778
|
-
|
|
45779
|
-
|
|
45780
|
-
|
|
45781
|
-
|
|
45782
|
-
|
|
45783
|
-
|
|
45784
|
-
|
|
45785
|
-
|
|
45786
|
-
|
|
45787
|
-
|
|
45788
|
-
|
|
45789
|
-
if (hasAudioVideoDevices) {
|
|
45790
|
-
(0, _permissionListener.default)().then(listener => {
|
|
45791
|
-
listener.on('accessDenied', device => {
|
|
45792
|
-
_this.accessAllowed = false;
|
|
45793
|
-
_this.dispatchEvent((0, _accessDeniedEvent.default)(device, 'during the call'));
|
|
45772
|
+
});
|
|
45773
|
+
widgetView.on('videoElementCreated', element => {
|
|
45774
|
+
_this.dispatchEvent(new Events.MediaStreamAvailableEvent(webRTCStream));
|
|
45775
|
+
const event = new Events.VideoElementCreatedEvent(element);
|
|
45776
|
+
_this.dispatchEvent(event);
|
|
45777
|
+
});
|
|
45778
|
+
getUserMedia().catch(err => {
|
|
45779
|
+
callback(err);
|
|
45780
|
+
userMediaError(err);
|
|
45781
|
+
}).then( /*#__PURE__*/function () {
|
|
45782
|
+
var _ref30 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(stream) {
|
|
45783
|
+
var _audioDevices, _videoDevices;
|
|
45784
|
+
var hasVideoFilter, addAudioInputDevicesChangeListener, hasAudioVideoDevices;
|
|
45785
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
45786
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
45787
|
+
case 0:
|
|
45788
|
+
// this comes from deviceHelpers.shouldAskForDevices in a round-about way
|
|
45789
|
+
audioDevices = processedOptions.audioDevices;
|
|
45790
|
+
videoDevices = processedOptions.videoDevices;
|
|
45791
|
+
hasVideoFilter = !!properties.videoFilter;
|
|
45792
|
+
if (!properties.disableAudioInputDeviceManagement) {
|
|
45793
|
+
// this is needed to refresh current audio input device after previous one was disconnected
|
|
45794
|
+
addAudioInputDevicesChangeListener = addAudioInputDevicesChangeListenerFactory();
|
|
45795
|
+
removeDeviceChangeListener = addAudioInputDevicesChangeListener(_this);
|
|
45796
|
+
}
|
|
45797
|
+
hasAudioVideoDevices = ((_audioDevices = audioDevices) == null ? void 0 : _audioDevices.length) > 0 || ((_videoDevices = videoDevices) == null ? void 0 : _videoDevices.length) > 0;
|
|
45798
|
+
if (hasAudioVideoDevices) {
|
|
45799
|
+
(0, _permissionListener.default)().then(listener => {
|
|
45800
|
+
listener.on('accessDenied', device => {
|
|
45801
|
+
_this.accessAllowed = false;
|
|
45802
|
+
const errorEvent = (0, _accessDeniedEvent.default)(device, 'during the call');
|
|
45803
|
+
_this.dispatchEvent(errorEvent);
|
|
45804
|
+
});
|
|
45794
45805
|
});
|
|
45795
|
-
});
|
|
45796
|
-
}
|
|
45797
|
-
if (hasVideoFilter) {
|
|
45798
|
-
// We need to get the device now, before the filter is applied
|
|
45799
|
-
// else the wrong device will be returned/nonsensical
|
|
45800
|
-
currentDeviceId = (0, _getDeviceIdFromStream.default)(stream, videoDevices);
|
|
45801
|
-
}
|
|
45802
|
-
_context20.next = 9;
|
|
45803
|
-
return onStreamAvailable(stream);
|
|
45804
|
-
case 9:
|
|
45805
|
-
if (!properties.publishVideo) {
|
|
45806
|
-
_this._toggleVideo(properties.publishVideo, getVideoDimensions());
|
|
45807
|
-
}
|
|
45808
|
-
if (!isScreenSharing && !isCustomVideoTrack
|
|
45809
|
-
// For filtered video, we stored the currentDeviceId already.
|
|
45810
|
-
// (see note above)
|
|
45811
|
-
&& !hasVideoFilter) {
|
|
45812
|
-
currentDeviceId = (0, _getDeviceIdFromStream.default)(stream, videoDevices);
|
|
45813
|
-
if (properties.publishVideo) {
|
|
45814
|
-
setCurrentTrackDeviceId(currentDeviceId);
|
|
45815
45806
|
}
|
|
45816
|
-
|
|
45817
|
-
|
|
45818
|
-
|
|
45819
|
-
|
|
45820
|
-
// to bindVideo before the old one succeeded, perhaps they called
|
|
45821
|
-
// switchTracks.. It should be rare, and they shouldn't be doing
|
|
45822
|
-
// this before loaded, but we'll handle it anyway.
|
|
45823
|
-
return undefined;
|
|
45807
|
+
if (hasVideoFilter) {
|
|
45808
|
+
// We need to get the device now, before the filter is applied
|
|
45809
|
+
// else the wrong device will be returned/nonsensical
|
|
45810
|
+
currentDeviceId = (0, _getDeviceIdFromStream.default)(stream, videoDevices);
|
|
45824
45811
|
}
|
|
45825
|
-
|
|
45826
|
-
|
|
45827
|
-
|
|
45828
|
-
if (!
|
|
45829
|
-
_this.
|
|
45830
|
-
_this.trigger('loaded', _this);
|
|
45812
|
+
_context20.next = 9;
|
|
45813
|
+
return onStreamAvailable(stream);
|
|
45814
|
+
case 9:
|
|
45815
|
+
if (!properties.publishVideo) {
|
|
45816
|
+
_this._toggleVideo(properties.publishVideo, getVideoDimensions());
|
|
45831
45817
|
}
|
|
45832
|
-
|
|
45833
|
-
|
|
45834
|
-
|
|
45835
|
-
|
|
45836
|
-
|
|
45837
|
-
|
|
45838
|
-
|
|
45839
|
-
|
|
45840
|
-
|
|
45841
|
-
|
|
45842
|
-
|
|
45843
|
-
|
|
45844
|
-
|
|
45845
|
-
|
|
45846
|
-
|
|
45818
|
+
if (!isScreenSharing && !isCustomVideoTrack
|
|
45819
|
+
// For filtered video, we stored the currentDeviceId already.
|
|
45820
|
+
// (see note above)
|
|
45821
|
+
&& !hasVideoFilter) {
|
|
45822
|
+
currentDeviceId = (0, _getDeviceIdFromStream.default)(stream, videoDevices);
|
|
45823
|
+
if (properties.publishVideo) {
|
|
45824
|
+
setCurrentTrackDeviceId(currentDeviceId);
|
|
45825
|
+
}
|
|
45826
|
+
}
|
|
45827
|
+
return _context20.abrupt("return", bindVideo().catch(error => {
|
|
45828
|
+
if (error instanceof _cancel.CancellationError) {
|
|
45829
|
+
// If we get a CancellationError, it means something newer tried
|
|
45830
|
+
// to bindVideo before the old one succeeded, perhaps they called
|
|
45831
|
+
// switchTracks.. It should be rare, and they shouldn't be doing
|
|
45832
|
+
// this before loaded, but we'll handle it anyway.
|
|
45833
|
+
return undefined;
|
|
45834
|
+
}
|
|
45835
|
+
throw error;
|
|
45836
|
+
}).then(() => {
|
|
45837
|
+
onLoaded();
|
|
45838
|
+
if (!state.isDestroyed()) {
|
|
45839
|
+
_this.trigger('initSuccess');
|
|
45840
|
+
_this.trigger('loaded', _this);
|
|
45841
|
+
callback();
|
|
45842
|
+
} else {
|
|
45843
|
+
callback(new Error('publisher destroyed'));
|
|
45844
|
+
}
|
|
45845
|
+
}, err => {
|
|
45846
|
+
logging.error(`OT.Publisher.publish failed to bind video: ${err}`);
|
|
45847
|
+
onLoadFailure(err);
|
|
45848
|
+
callback(err);
|
|
45849
|
+
}));
|
|
45850
|
+
case 12:
|
|
45851
|
+
case "end":
|
|
45852
|
+
return _context20.stop();
|
|
45853
|
+
}
|
|
45854
|
+
}, _callee20);
|
|
45855
|
+
}));
|
|
45856
|
+
return function (_x12) {
|
|
45857
|
+
return _ref30.apply(this, arguments);
|
|
45858
|
+
};
|
|
45859
|
+
}());
|
|
45860
|
+
});
|
|
45861
|
+
} catch (err) {
|
|
45862
|
+
callback(err);
|
|
45863
|
+
}
|
|
45864
|
+
};
|
|
45865
|
+
this.publish = targetElement => {
|
|
45866
|
+
publishWithCallback(targetElement);
|
|
45847
45867
|
return this;
|
|
45848
45868
|
};
|
|
45869
|
+
this.publish.promise = targetElement => new Promise((resolve, reject) => {
|
|
45870
|
+
publishWithCallback(targetElement, err => {
|
|
45871
|
+
if (err) {
|
|
45872
|
+
reject(err);
|
|
45873
|
+
} else {
|
|
45874
|
+
resolve(this);
|
|
45875
|
+
}
|
|
45876
|
+
});
|
|
45877
|
+
});
|
|
45849
45878
|
this._getRoutedVideoSenders = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
45850
45879
|
var routedPeerConnection;
|
|
45851
45880
|
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
@@ -46014,6 +46043,30 @@ function PublisherFactory(_ref) {
|
|
|
46014
46043
|
}
|
|
46015
46044
|
refreshAudioVideoUI(activeReason);
|
|
46016
46045
|
};
|
|
46046
|
+
const publishAudioWithCallback = function publishAudioWithCallback(value, callback) {
|
|
46047
|
+
if (callback === void 0) {
|
|
46048
|
+
callback = () => {};
|
|
46049
|
+
}
|
|
46050
|
+
logAnalyticsEvent('publishAudio', 'Attempt', {
|
|
46051
|
+
publishAudio: value
|
|
46052
|
+
});
|
|
46053
|
+
const attemptStart = Date.now();
|
|
46054
|
+
properties.publishAudio = value;
|
|
46055
|
+
try {
|
|
46056
|
+
updateAudio();
|
|
46057
|
+
logAnalyticsEvent('publishAudio', 'Success', {
|
|
46058
|
+
publishAudio: value
|
|
46059
|
+
}, {
|
|
46060
|
+
attemptDuration: Date.now() - attemptStart
|
|
46061
|
+
});
|
|
46062
|
+
callback();
|
|
46063
|
+
} catch (err) {
|
|
46064
|
+
logAnalyticsEvent('publishAudio', 'Failure', {
|
|
46065
|
+
message: err.message
|
|
46066
|
+
});
|
|
46067
|
+
callback(err);
|
|
46068
|
+
}
|
|
46069
|
+
};
|
|
46017
46070
|
|
|
46018
46071
|
/**
|
|
46019
46072
|
* Starts publishing audio (if it is currently not being published)
|
|
@@ -46030,26 +46083,44 @@ function PublisherFactory(_ref) {
|
|
|
46030
46083
|
* @memberOf Publisher
|
|
46031
46084
|
*/
|
|
46032
46085
|
this.publishAudio = value => {
|
|
46033
|
-
|
|
46034
|
-
publishAudio: value
|
|
46035
|
-
});
|
|
46036
|
-
const attemptStart = Date.now();
|
|
46037
|
-
properties.publishAudio = value;
|
|
46038
|
-
try {
|
|
46039
|
-
updateAudio();
|
|
46040
|
-
logAnalyticsEvent('publishAudio', 'Success', {
|
|
46041
|
-
publishAudio: value
|
|
46042
|
-
}, {
|
|
46043
|
-
attemptDuration: Date.now() - attemptStart
|
|
46044
|
-
});
|
|
46045
|
-
} catch (e) {
|
|
46046
|
-
logAnalyticsEvent('publishAudio', 'Failure', {
|
|
46047
|
-
message: e.message
|
|
46048
|
-
});
|
|
46049
|
-
}
|
|
46086
|
+
publishAudioWithCallback(value);
|
|
46050
46087
|
return this;
|
|
46051
46088
|
};
|
|
46052
|
-
|
|
46089
|
+
|
|
46090
|
+
/**
|
|
46091
|
+
* Promise-based variant of {@link Publisher#publishAudio}.
|
|
46092
|
+
* Resolves when the session confirms the audio state change via a
|
|
46093
|
+
* <code>streamPropertyChanged</code> event, or rejects with an error if it fails.
|
|
46094
|
+
*
|
|
46095
|
+
* @param {Boolean} value Whether to start publishing audio (<code>true</code>)
|
|
46096
|
+
* or not (<code>false</code>).
|
|
46097
|
+
* @returns {Promise<void>} Resolves on success, rejects with an
|
|
46098
|
+
* <code><a href="Error.html">Error</a></code> on failure.
|
|
46099
|
+
*
|
|
46100
|
+
* @example
|
|
46101
|
+
* await publisher.publishAudio.promise(false);
|
|
46102
|
+
*
|
|
46103
|
+
* @method #publishAudio.promise
|
|
46104
|
+
* @memberOf Publisher
|
|
46105
|
+
*/
|
|
46106
|
+
this.publishAudio.promise = value => new Promise((resolve, reject) => {
|
|
46107
|
+
if (!this.session) {
|
|
46108
|
+
reject(new Error('Cannot publish audio before publishing to a session'));
|
|
46109
|
+
return;
|
|
46110
|
+
}
|
|
46111
|
+
if (properties.publishAudio === value) {
|
|
46112
|
+
resolve();
|
|
46113
|
+
return;
|
|
46114
|
+
}
|
|
46115
|
+
publishAudioWithCallback(value, err => {
|
|
46116
|
+
if (err) {
|
|
46117
|
+
reject(err);
|
|
46118
|
+
} else {
|
|
46119
|
+
resolve();
|
|
46120
|
+
}
|
|
46121
|
+
});
|
|
46122
|
+
});
|
|
46123
|
+
const finishPublishCaptions = (value, resolve, reject) => {
|
|
46053
46124
|
try {
|
|
46054
46125
|
privateEvents.dispatchEvent(new Events.PublisherCaptionsEnabled(value));
|
|
46055
46126
|
this.stream.setChannelActiveState({
|
|
@@ -46059,11 +46130,13 @@ function PublisherFactory(_ref) {
|
|
|
46059
46130
|
logAnalyticsEvent('publishCaptions', 'Success', {
|
|
46060
46131
|
publishCaptions: value
|
|
46061
46132
|
});
|
|
46133
|
+
resolve();
|
|
46062
46134
|
} catch (e) {
|
|
46063
46135
|
logAnalyticsEvent('publishCaptions', 'Failure', {
|
|
46064
46136
|
message: e.message,
|
|
46065
46137
|
publishCaptions: value
|
|
46066
46138
|
});
|
|
46139
|
+
reject(e);
|
|
46067
46140
|
}
|
|
46068
46141
|
};
|
|
46069
46142
|
|
|
@@ -46088,20 +46161,20 @@ function PublisherFactory(_ref) {
|
|
|
46088
46161
|
* @see <a href="Subscriber.html#isSubscribedToCaptions">isSubscribedToCaptions()</a>
|
|
46089
46162
|
* @see <a href="Stream.html#hasCaptions">Stream.hasCaptions</a>
|
|
46090
46163
|
* @see StreamPropertyChangedEvent
|
|
46164
|
+
* @returns {Promise}
|
|
46091
46165
|
* @method #publishCaptions
|
|
46092
46166
|
* @memberOf Publisher
|
|
46093
46167
|
*/
|
|
46094
|
-
|
|
46095
|
-
this.publishCaptions = value => {
|
|
46168
|
+
this.publishCaptions = value => new Promise((resolve, reject) => {
|
|
46096
46169
|
logAnalyticsEvent('publishCaptions', 'Attempt', {
|
|
46097
46170
|
publishCaptions: value
|
|
46098
46171
|
});
|
|
46099
46172
|
if (this.stream) {
|
|
46100
|
-
finishPublishCaptions(value);
|
|
46173
|
+
finishPublishCaptions(value, resolve, reject);
|
|
46101
46174
|
} else {
|
|
46102
|
-
streamReadyJobs.add(() => finishPublishCaptions(value));
|
|
46175
|
+
streamReadyJobs.add(() => finishPublishCaptions(value, resolve, reject));
|
|
46103
46176
|
}
|
|
46104
|
-
};
|
|
46177
|
+
});
|
|
46105
46178
|
let updateVideoSenderParametersSentinel;
|
|
46106
46179
|
|
|
46107
46180
|
// keeps track of if the client has called mediaStreamTrack.stop(), so that we don't restart
|
|
@@ -46598,6 +46671,31 @@ function PublisherFactory(_ref) {
|
|
|
46598
46671
|
});
|
|
46599
46672
|
return this;
|
|
46600
46673
|
};
|
|
46674
|
+
|
|
46675
|
+
/**
|
|
46676
|
+
* Promise-based variant of {@link Publisher#publishVideo}.
|
|
46677
|
+
* Resolves when the operation completes, or rejects with an error if it fails.
|
|
46678
|
+
*
|
|
46679
|
+
* @param {Boolean} value Whether to start publishing video (<code>true</code>)
|
|
46680
|
+
* or not (<code>false</code>).
|
|
46681
|
+
* @returns {Promise<void>} Resolves on success, rejects with an
|
|
46682
|
+
* <code><a href="Error.html">Error</a></code> on failure.
|
|
46683
|
+
*
|
|
46684
|
+
* @example
|
|
46685
|
+
* await publisher.publishVideo.promise(true);
|
|
46686
|
+
*
|
|
46687
|
+
* @method #publishVideo.promise
|
|
46688
|
+
* @memberOf Publisher
|
|
46689
|
+
*/
|
|
46690
|
+
this.publishVideo.promise = value => new Promise((resolve, reject) => {
|
|
46691
|
+
this.publishVideo(value, err => {
|
|
46692
|
+
if (err) {
|
|
46693
|
+
reject(err);
|
|
46694
|
+
} else {
|
|
46695
|
+
resolve();
|
|
46696
|
+
}
|
|
46697
|
+
});
|
|
46698
|
+
});
|
|
46601
46699
|
this._publishVideo = /*#__PURE__*/function () {
|
|
46602
46700
|
var _ref44 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(value) {
|
|
46603
46701
|
var videoDimensions;
|
|
@@ -47412,7 +47510,7 @@ function PublisherFactory(_ref) {
|
|
|
47412
47510
|
let shouldRePublishVideo = false;
|
|
47413
47511
|
if (properties.publishVideo && document.hidden) {
|
|
47414
47512
|
shouldRePublishVideo = true;
|
|
47415
|
-
//
|
|
47513
|
+
// Turning the video off to prevent that videotrack is ended.
|
|
47416
47514
|
this.publishVideo(false);
|
|
47417
47515
|
}
|
|
47418
47516
|
// trigger the handler onVisibilityChange
|
|
@@ -80783,7 +80881,7 @@ var _default = function _default(_temp) {
|
|
|
80783
80881
|
if (resolvedPredicate) {
|
|
80784
80882
|
clearTimeout(timeoutTimerId);
|
|
80785
80883
|
intervalRunner.stop();
|
|
80786
|
-
resolve();
|
|
80884
|
+
resolve(resolvedPredicate);
|
|
80787
80885
|
}
|
|
80788
80886
|
case 6:
|
|
80789
80887
|
case "end":
|
|
@@ -80815,10 +80913,11 @@ var _default = function _default(_temp) {
|
|
|
80815
80913
|
return false;
|
|
80816
80914
|
}
|
|
80817
80915
|
}
|
|
80818
|
-
|
|
80916
|
+
const resolvedPredicate = tryPredicate();
|
|
80917
|
+
if (resolvedPredicate) {
|
|
80819
80918
|
clearTimeout(timeoutTimerId);
|
|
80820
80919
|
intervalRunner.stop();
|
|
80821
|
-
resolve();
|
|
80920
|
+
resolve(resolvedPredicate);
|
|
80822
80921
|
}
|
|
80823
80922
|
}, frequency);
|
|
80824
80923
|
timeoutTimerId = setTimeout(() => {
|