agora-rte-sdk 3.8.2 → 3.9.0-alpha
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/lib/constant.d.ts +9 -0
- package/lib/constant.js +13 -2
- package/lib/core/engine/ap-detector.d.ts +4 -4
- package/lib/core/engine/ap-detector.js +33 -20
- package/lib/core/engine/index.d.ts +19 -11
- package/lib/core/engine/index.js +132 -48
- package/lib/core/engine/plugin.js +2 -2
- package/lib/core/engine/type.d.ts +29 -0
- package/lib/core/engine/type.js +6 -0
- package/lib/core/media/camera.d.ts +8 -8
- package/lib/core/media/camera.js +38 -21
- package/lib/core/media/effect-enhancer.d.ts +5 -6
- package/lib/core/media/effect-enhancer.js +6 -16
- package/lib/core/media/index.d.ts +1 -155
- package/lib/core/media/index.js +44 -15
- package/lib/core/media/loopback.d.ts +3 -3
- package/lib/core/media/loopback.js +18 -11
- package/lib/core/media/microphone.d.ts +6 -6
- package/lib/core/media/microphone.js +32 -16
- package/lib/core/media/screen.d.ts +13 -5
- package/lib/core/media/screen.js +46 -16
- package/lib/core/media/type.d.ts +159 -2
- package/lib/core/media/type.js +4 -1
- package/lib/core/processor/message-handler.d.ts +4 -4
- package/lib/core/processor/message-handler.js +66 -28
- package/lib/core/processor/sequence-msg/data.d.ts +9 -7
- package/lib/core/processor/sequence-msg/data.js +26 -3
- package/lib/core/processor/struct.js +2 -2
- package/lib/core/processor/synchronizer/synchronizer-manager.d.ts +10 -0
- package/lib/core/processor/synchronizer/synchronizer-manager.js +43 -4
- package/lib/core/rtc/capture-enhancement.d.ts +4 -14
- package/lib/core/rtc/channel.d.ts +4 -4
- package/lib/core/rtc/constant.d.ts +1 -5
- package/lib/core/rtc/constant.js +2 -8
- package/lib/core/rtc/publish-pool.d.ts +20 -8
- package/lib/core/rtc/publish-pool.js +272 -3
- package/lib/core/rtc/publisher.d.ts +20 -14
- package/lib/core/rtc/publisher.js +151 -7
- package/lib/core/rtc/source-manager.d.ts +12 -2
- package/lib/core/rtc/subscriber.d.ts +14 -6
- package/lib/core/rtc/subscriber.js +171 -4
- package/lib/core/rtc/type.d.ts +6 -17
- package/lib/core/rtc/type.js +10 -26
- package/lib/core/rtm/channel.d.ts +3 -3
- package/lib/core/rtm/client.d.ts +4 -4
- package/lib/core/rtm/type.d.ts +1 -2
- package/lib/core/scene/helpers/ap-detect.d.ts +5 -0
- package/lib/core/scene/helpers/ap-detect.js +153 -0
- package/lib/core/scene/helpers/join.d.ts +8 -0
- package/lib/core/scene/helpers/join.js +105 -0
- package/lib/core/scene/helpers/rtc-event.d.ts +4 -0
- package/lib/core/scene/helpers/rtc-event.js +36 -0
- package/lib/core/scene/helpers/stream-publish-handlers.d.ts +15 -0
- package/lib/core/scene/helpers/stream-publish-handlers.js +121 -0
- package/lib/core/scene/helpers/stream-type.d.ts +7 -0
- package/lib/core/scene/{helper.js → helpers/stream-type.js} +3 -32
- package/lib/core/scene/index.d.ts +69 -187
- package/lib/core/scene/index.js +813 -1368
- package/lib/core/scene/local-user.d.ts +19 -85
- package/lib/core/scene/local-user.js +151 -152
- package/lib/core/scene/state-sync.d.ts +5 -7
- package/lib/core/scene/state-sync.js +20 -43
- package/lib/core/scene/stream-player.d.ts +9 -8
- package/lib/core/scene/stream-player.js +13 -10
- package/lib/core/scene/type.d.ts +359 -9
- package/lib/core/services/api.d.ts +9 -0
- package/lib/core/services/api.js +96 -58
- package/lib/core/services/auth-headers.d.ts +1 -0
- package/lib/core/services/auth-headers.js +5 -2
- package/lib/core/services/client.d.ts +3 -0
- package/lib/core/services/client.js +14 -2
- package/lib/core/services/type.d.ts +1 -0
- package/lib/core/type.d.ts +1 -0
- package/lib/core/type.js +6 -0
- package/lib/core/utilities/abort-manager.d.ts +18 -0
- package/lib/core/utilities/abort-manager.js +154 -0
- package/lib/core/utilities/error.d.ts +5 -36
- package/lib/core/utilities/error.js +23 -92
- package/lib/core/utilities/join-manager.d.ts +54 -0
- package/lib/core/utilities/join-manager.js +198 -0
- package/lib/core/utilities/logger.d.ts +2 -0
- package/lib/core/utilities/logger.js +8 -13
- package/lib/core/utilities/package-info.d.ts +1 -0
- package/lib/core/utilities/package-info.js +6 -4
- package/lib/core/utilities/property-extract.d.ts +2 -0
- package/lib/core/utilities/property-extract.js +79 -0
- package/lib/core/utilities/weak-invoker.d.ts +11 -0
- package/lib/core/utilities/weak-invoker.js +121 -0
- package/lib/imports.d.ts +6 -4
- package/lib/imports.js +42 -17
- package/lib/index.d.ts +7 -5
- package/lib/index.js +6 -5
- package/lib/plugin/restful-client/index.d.ts +1 -1
- package/lib/plugin/restful-client/index.js +11 -10
- package/lib/plugin/rtc/electron/camera-preview-task-manager.d.ts +14 -0
- package/lib/plugin/rtc/electron/camera-preview-task-manager.js +125 -0
- package/lib/plugin/rtc/electron/canvas-helper.d.ts +2 -2
- package/lib/plugin/rtc/electron/canvas-helper.js +15 -12
- package/lib/plugin/rtc/electron/canvas-tag-pool.d.ts +4 -4
- package/lib/plugin/rtc/electron/canvas-tag-pool.js +21 -13
- package/lib/plugin/rtc/electron/capture-enhancement.d.ts +3 -5
- package/lib/plugin/rtc/electron/capture-enhancement.js +45 -29
- package/lib/plugin/rtc/electron/channel.d.ts +13 -16
- package/lib/plugin/rtc/electron/channel.js +48 -57
- package/lib/plugin/rtc/electron/client.d.ts +8 -4
- package/lib/plugin/rtc/electron/client.js +107 -72
- package/lib/plugin/rtc/electron/constants.d.ts +12 -1
- package/lib/plugin/rtc/electron/constants.js +94 -26
- package/lib/plugin/rtc/electron/desc-type.js +1 -1
- package/lib/plugin/rtc/electron/downloadALD.js +9 -7
- package/lib/plugin/rtc/electron/publish-pool.d.ts +9 -17
- package/lib/plugin/rtc/electron/publish-pool.js +110 -256
- package/lib/plugin/rtc/electron/publisher.d.ts +9 -21
- package/lib/plugin/rtc/electron/publisher.js +80 -254
- package/lib/plugin/rtc/electron/source-manager.d.ts +22 -16
- package/lib/plugin/rtc/electron/source-manager.js +345 -215
- package/lib/plugin/rtc/electron/source-state-control/loopback-state-control.d.ts +1 -5
- package/lib/plugin/rtc/electron/source-state-control/loopback-state-control.js +2 -18
- package/lib/plugin/rtc/electron/source-state-control/media-state-control.d.ts +18 -0
- package/lib/plugin/rtc/electron/source-state-control/{camera-state-control.js → media-state-control.js} +50 -104
- package/lib/plugin/rtc/electron/source-state-control/microphone-state-control.d.ts +4 -10
- package/lib/plugin/rtc/electron/source-state-control/microphone-state-control.js +5 -26
- package/lib/plugin/rtc/electron/source-state-control/source-state-control.d.ts +30 -26
- package/lib/plugin/rtc/electron/source-state-control/source-state-control.js +68 -110
- package/lib/plugin/rtc/electron/subscriber.d.ts +7 -16
- package/lib/plugin/rtc/electron/subscriber.js +34 -112
- package/lib/plugin/rtc/electron/type.d.ts +7 -3
- package/lib/plugin/rtc/electron/type.js +8 -2
- package/lib/plugin/rtc/electron/utils.d.ts +9 -6
- package/lib/plugin/rtc/electron/utils.js +37 -9
- package/lib/plugin/rtc/web/assembler.d.ts +2 -1
- package/lib/plugin/rtc/web/assembler.js +9 -2
- package/lib/plugin/rtc/web/audio-player.d.ts +1 -1
- package/lib/plugin/rtc/web/audio-player.js +13 -8
- package/lib/plugin/rtc/web/canvas-helper.d.ts +1 -1
- package/lib/plugin/rtc/web/canvas-helper.js +3 -1
- package/lib/plugin/rtc/web/capture-enhancement.d.ts +3 -5
- package/lib/plugin/rtc/web/capture-enhancement.js +14 -20
- package/lib/plugin/rtc/web/channel.d.ts +17 -13
- package/lib/plugin/rtc/web/channel.js +221 -124
- package/lib/plugin/rtc/web/client.d.ts +5 -3
- package/lib/plugin/rtc/web/client.js +49 -21
- package/lib/plugin/rtc/web/convert-type.d.ts +3 -0
- package/lib/plugin/rtc/web/convert-type.js +22 -0
- package/lib/plugin/rtc/web/device.js +2 -3
- package/lib/plugin/rtc/web/effect-enabler.js +3 -3
- package/lib/plugin/rtc/web/extension.d.ts +1 -1
- package/lib/plugin/rtc/web/extension.js +4 -1
- package/lib/plugin/rtc/web/publish-pool.d.ts +4 -17
- package/lib/plugin/rtc/web/publish-pool.js +41 -194
- package/lib/plugin/rtc/web/publish.d.ts +9 -8
- package/lib/plugin/rtc/web/publish.js +71 -27
- package/lib/plugin/rtc/web/publisher.d.ts +20 -12
- package/lib/plugin/rtc/web/publisher.js +118 -69
- package/lib/plugin/rtc/web/source-manager.d.ts +1 -0
- package/lib/plugin/rtc/web/source-manager.js +15 -9
- package/lib/plugin/rtc/web/subscribe.d.ts +10 -10
- package/lib/plugin/rtc/web/subscribe.js +26 -14
- package/lib/plugin/rtc/web/subscriber.d.ts +5 -10
- package/lib/plugin/rtc/web/subscriber.js +21 -82
- package/lib/plugin/rtc/web/track-control/camera.d.ts +1 -1
- package/lib/plugin/rtc/web/track-control/camera.js +4 -1
- package/lib/plugin/rtc/web/track-control/screen.d.ts +1 -1
- package/lib/plugin/rtc/web/track-control/screen.js +4 -1
- package/lib/plugin/rtm/channel.d.ts +8 -5
- package/lib/plugin/rtm/channel.js +113 -49
- package/lib/plugin/rtm/client.d.ts +10 -5
- package/lib/plugin/rtm/client.js +120 -61
- package/lib/plugin/rtm/utils.js +1 -1
- package/lib/plugin/synchronizer-worker/worker.js +71 -7
- package/lib/type.d.ts +0 -5
- package/lib-es/constant.js +12 -1
- package/lib-es/core/engine/ap-detector.js +36 -22
- package/lib-es/core/engine/index.js +134 -50
- package/lib-es/core/engine/plugin.js +1 -1
- package/lib-es/core/engine/type.js +1 -0
- package/lib-es/core/media/camera.js +38 -22
- package/lib-es/core/media/effect-enhancer.js +6 -16
- package/lib-es/core/media/index.js +44 -17
- package/lib-es/core/media/loopback.js +18 -12
- package/lib-es/core/media/microphone.js +32 -17
- package/lib-es/core/media/screen.js +46 -17
- package/lib-es/core/media/type.js +5 -1
- package/lib-es/core/processor/message-handler.js +44 -6
- package/lib-es/core/processor/sequence-msg/data.js +27 -4
- package/lib-es/core/processor/struct.js +1 -1
- package/lib-es/core/processor/synchronizer/synchronizer-manager.js +43 -4
- package/lib-es/core/rtc/constant.js +1 -7
- package/lib-es/core/rtc/publish-pool.js +274 -4
- package/lib-es/core/rtc/publisher.js +153 -9
- package/lib-es/core/rtc/subscriber.js +172 -4
- package/lib-es/core/rtc/type.js +9 -25
- package/lib-es/core/scene/helpers/ap-detect.js +143 -0
- package/lib-es/core/scene/helpers/join.js +97 -0
- package/lib-es/core/scene/helpers/rtc-event.js +29 -0
- package/lib-es/core/scene/helpers/stream-publish-handlers.js +112 -0
- package/lib-es/core/scene/helpers/stream-type.js +43 -0
- package/lib-es/core/scene/index.js +817 -1373
- package/lib-es/core/scene/local-user.js +144 -146
- package/lib-es/core/scene/state-sync.js +19 -42
- package/lib-es/core/scene/stream-player.js +13 -10
- package/lib-es/core/services/api.js +97 -59
- package/lib-es/core/services/auth-headers.js +4 -1
- package/lib-es/core/services/client.js +13 -1
- package/lib-es/core/type.js +1 -0
- package/lib-es/core/utilities/abort-manager.js +146 -0
- package/lib-es/core/utilities/error.js +22 -91
- package/lib-es/core/utilities/join-manager.js +190 -0
- package/lib-es/core/utilities/logger.js +8 -13
- package/lib-es/core/utilities/package-info.js +5 -3
- package/lib-es/core/utilities/property-extract.js +71 -0
- package/lib-es/core/utilities/weak-invoker.js +113 -0
- package/lib-es/imports.js +9 -5
- package/lib-es/index.js +3 -2
- package/lib-es/plugin/restful-client/index.js +5 -4
- package/lib-es/plugin/rtc/electron/camera-preview-task-manager.js +117 -0
- package/lib-es/plugin/rtc/electron/canvas-helper.js +15 -12
- package/lib-es/plugin/rtc/electron/canvas-tag-pool.js +21 -13
- package/lib-es/plugin/rtc/electron/capture-enhancement.js +46 -30
- package/lib-es/plugin/rtc/electron/channel.js +49 -58
- package/lib-es/plugin/rtc/electron/client.js +107 -72
- package/lib-es/plugin/rtc/electron/constants.js +93 -25
- package/lib-es/plugin/rtc/electron/desc-type.js +1 -1
- package/lib-es/plugin/rtc/electron/downloadALD.js +10 -8
- package/lib-es/plugin/rtc/electron/publish-pool.js +111 -257
- package/lib-es/plugin/rtc/electron/publisher.js +51 -226
- package/lib-es/plugin/rtc/electron/source-manager.js +348 -218
- package/lib-es/plugin/rtc/electron/source-state-control/loopback-state-control.js +2 -18
- package/lib-es/plugin/rtc/electron/source-state-control/{camera-state-control.js → media-state-control.js} +64 -118
- package/lib-es/plugin/rtc/electron/source-state-control/microphone-state-control.js +5 -26
- package/lib-es/plugin/rtc/electron/source-state-control/source-state-control.js +69 -109
- package/lib-es/plugin/rtc/electron/subscriber.js +38 -116
- package/lib-es/plugin/rtc/electron/type.js +7 -1
- package/lib-es/plugin/rtc/electron/utils.js +37 -9
- package/lib-es/plugin/rtc/web/assembler.js +9 -2
- package/lib-es/plugin/rtc/web/audio-player.js +14 -9
- package/lib-es/plugin/rtc/web/canvas-helper.js +3 -1
- package/lib-es/plugin/rtc/web/capture-enhancement.js +14 -20
- package/lib-es/plugin/rtc/web/channel.js +234 -137
- package/lib-es/plugin/rtc/web/client.js +50 -22
- package/lib-es/plugin/rtc/web/convert-type.js +15 -0
- package/lib-es/plugin/rtc/web/device.js +3 -4
- package/lib-es/plugin/rtc/web/effect-enabler.js +3 -3
- package/lib-es/plugin/rtc/web/extension.js +4 -1
- package/lib-es/plugin/rtc/web/publish-pool.js +45 -198
- package/lib-es/plugin/rtc/web/publish.js +71 -27
- package/lib-es/plugin/rtc/web/publisher.js +122 -72
- package/lib-es/plugin/rtc/web/source-manager.js +16 -10
- package/lib-es/plugin/rtc/web/subscribe.js +26 -14
- package/lib-es/plugin/rtc/web/subscriber.js +25 -86
- package/lib-es/plugin/rtc/web/track-control/camera.js +4 -1
- package/lib-es/plugin/rtc/web/track-control/screen.js +4 -1
- package/lib-es/plugin/rtm/channel.js +112 -48
- package/lib-es/plugin/rtm/client.js +116 -57
- package/lib-es/plugin/rtm/utils.js +1 -1
- package/lib-es/plugin/synchronizer-worker/worker.js +71 -7
- package/package.json +4 -4
- package/lib/core/scene/helper.d.ts +0 -10
- package/lib/plugin/rtc/electron/source-state-control/camera-state-control.d.ts +0 -28
- package/lib/plugin/rtc/electron/source-state-control/screen-state-control.d.ts +0 -31
- package/lib/plugin/rtc/electron/source-state-control/screen-state-control.js +0 -213
- package/lib/plugin/rtc/electron/source-state-control/window-state-control.d.ts +0 -31
- package/lib/plugin/rtc/electron/source-state-control/window-state-control.js +0 -213
- package/lib-es/core/scene/helper.js +0 -72
- package/lib-es/plugin/rtc/electron/source-state-control/screen-state-control.js +0 -206
- package/lib-es/plugin/rtc/electron/source-state-control/window-state-control.js +0 -206
|
@@ -39,7 +39,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
39
39
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
40
40
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
41
41
|
var _AgoraRteStreamPlayer;
|
|
42
|
-
var _initProto;
|
|
42
|
+
var _initProto, _subscribeRemoteVideoStreamDecs, _unsubscribeRemoteVideoStreamDecs, _startRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamDecs, _startPlayRemoteAudioStreamDecs, _stopPlayRemoteAudioStreamDecs, _setAudioRawDataConfigDecs, _adjustRemoteAudioStreamVolumeDecs, _takeSnapshotDecs, _ref;
|
|
43
43
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
44
44
|
import "core-js/modules/es.object.to-string.js";
|
|
45
45
|
import "core-js/modules/es.promise.js";
|
|
@@ -48,12 +48,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
48
48
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
49
49
|
function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
50
50
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
|
|
51
|
+
import { AgoraRteReturnCode } from '../../constant';
|
|
51
52
|
import { AgoraObservable, trace } from '../../imports';
|
|
52
53
|
import { createLogger } from '../utilities/logger';
|
|
54
|
+
_ref = (_subscribeRemoteVideoStreamDecs = trace(['streamId', 'type']), _unsubscribeRemoteVideoStreamDecs = trace(['streamId']), _startRenderRemoteVideoStreamDecs = trace(['streamId', 'renderMode', 'isMirror', 'view']), _stopRenderRemoteVideoStreamDecs = trace(['streamId', 'view']), _startPlayRemoteAudioStreamDecs = trace(['streamId']), _stopPlayRemoteAudioStreamDecs = trace(['streamId']), _setAudioRawDataConfigDecs = trace(['config']), _adjustRemoteAudioStreamVolumeDecs = trace(['streamId', 'volume']), _takeSnapshotDecs = trace(['streamId', 'filePath']), "logger");
|
|
53
55
|
export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
54
56
|
function AgoraRteStreamPlayer(rtcChannel) {
|
|
55
57
|
_classCallCheck(this, AgoraRteStreamPlayer);
|
|
56
|
-
_defineProperty(this,
|
|
58
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
57
59
|
prefix: 'AgoraRteStreamPlayer'
|
|
58
60
|
})));
|
|
59
61
|
_defineProperty(this, "observable", new AgoraObservable());
|
|
@@ -78,7 +80,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
78
80
|
}, {
|
|
79
81
|
key: "subscribeRemoteVideoStream",
|
|
80
82
|
value: function subscribeRemoteVideoStream(streamId, type) {
|
|
81
|
-
this._rtcChannel.subscriber.subscribeRemoteVideoStream(streamId, type);
|
|
83
|
+
return this._rtcChannel.subscriber.subscribeRemoteVideoStream(streamId, type);
|
|
82
84
|
}
|
|
83
85
|
/**
|
|
84
86
|
* Unsubscribe from a remote audio stream, you will stop receiving the video data of this stream.
|
|
@@ -87,7 +89,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
87
89
|
}, {
|
|
88
90
|
key: "unsubscribeRemoteVideoStream",
|
|
89
91
|
value: function unsubscribeRemoteVideoStream(streamId) {
|
|
90
|
-
this._rtcChannel.subscriber.unsubscribeRemoteVideoStream(streamId);
|
|
92
|
+
return this._rtcChannel.subscriber.unsubscribeRemoteVideoStream(streamId);
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
95
|
* Render the video of the remote user on the canvas.
|
|
@@ -101,7 +103,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
101
103
|
}, {
|
|
102
104
|
key: "startRenderRemoteVideoStream",
|
|
103
105
|
value: function startRenderRemoteVideoStream(streamId, renderMode, isMirror, view) {
|
|
104
|
-
this._rtcChannel.startRenderRemoteVideoStream(streamId, view, renderMode, isMirror);
|
|
106
|
+
return this._rtcChannel.startRenderRemoteVideoStream(streamId, view, renderMode, isMirror);
|
|
105
107
|
}
|
|
106
108
|
/**
|
|
107
109
|
* Stop rendering the video of the remote user on the canvas.
|
|
@@ -111,7 +113,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
111
113
|
}, {
|
|
112
114
|
key: "stopRenderRemoteVideoStream",
|
|
113
115
|
value: function stopRenderRemoteVideoStream(streamId, view) {
|
|
114
|
-
this._rtcChannel.stopRenderRemoteVideoStream(streamId, view);
|
|
116
|
+
return this._rtcChannel.stopRenderRemoteVideoStream(streamId, view);
|
|
115
117
|
}
|
|
116
118
|
/**
|
|
117
119
|
* Subscribe to a remote audio stream, you will start receiving the audio data of this stream and play the audio.
|
|
@@ -120,7 +122,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
120
122
|
}, {
|
|
121
123
|
key: "startPlayRemoteAudioStream",
|
|
122
124
|
value: function startPlayRemoteAudioStream(streamId) {
|
|
123
|
-
this._rtcChannel.subscriber.subscribeRemoteAudioStream(streamId);
|
|
125
|
+
return this._rtcChannel.subscriber.subscribeRemoteAudioStream(streamId);
|
|
124
126
|
}
|
|
125
127
|
/**
|
|
126
128
|
* Unsubscribe from a remote audio stream, you will stop receiving the audio data of this stream.
|
|
@@ -129,12 +131,13 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
129
131
|
}, {
|
|
130
132
|
key: "stopPlayRemoteAudioStream",
|
|
131
133
|
value: function stopPlayRemoteAudioStream(streamId) {
|
|
132
|
-
this._rtcChannel.subscriber.unsubscribeRemoteAudioStream(streamId);
|
|
134
|
+
return this._rtcChannel.subscriber.unsubscribeRemoteAudioStream(streamId);
|
|
133
135
|
}
|
|
134
136
|
}, {
|
|
135
137
|
key: "setAudioRawDataConfig",
|
|
136
138
|
value: function setAudioRawDataConfig(config) {
|
|
137
139
|
// this._rtcClient.setAudioRawDataConfig('', config);
|
|
140
|
+
return AgoraRteReturnCode.SUCCESS;
|
|
138
141
|
}
|
|
139
142
|
/**
|
|
140
143
|
* Set the volume of the remote audio stream.
|
|
@@ -144,7 +147,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
144
147
|
}, {
|
|
145
148
|
key: "adjustRemoteAudioStreamVolume",
|
|
146
149
|
value: function adjustRemoteAudioStreamVolume(streamId, volume) {
|
|
147
|
-
this._rtcChannel.adjustRemoteAudioStreamVolume(streamId, volume);
|
|
150
|
+
return this._rtcChannel.adjustRemoteAudioStreamVolume(streamId, volume);
|
|
148
151
|
}
|
|
149
152
|
}, {
|
|
150
153
|
key: "takeSnapshot",
|
|
@@ -190,7 +193,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
190
193
|
}]);
|
|
191
194
|
}();
|
|
192
195
|
_AgoraRteStreamPlayer = AgoraRteStreamPlayer;
|
|
193
|
-
var _applyDecs$e = _applyDecs(_AgoraRteStreamPlayer, [[
|
|
196
|
+
var _applyDecs$e = _applyDecs(_AgoraRteStreamPlayer, [[_subscribeRemoteVideoStreamDecs, 2, "subscribeRemoteVideoStream"], [_unsubscribeRemoteVideoStreamDecs, 2, "unsubscribeRemoteVideoStream"], [_startRenderRemoteVideoStreamDecs, 2, "startRenderRemoteVideoStream"], [_stopRenderRemoteVideoStreamDecs, 2, "stopRenderRemoteVideoStream"], [_startPlayRemoteAudioStreamDecs, 2, "startPlayRemoteAudioStream"], [_stopPlayRemoteAudioStreamDecs, 2, "stopPlayRemoteAudioStream"], [_setAudioRawDataConfigDecs, 2, "setAudioRawDataConfig"], [_adjustRemoteAudioStreamVolumeDecs, 2, "adjustRemoteAudioStreamVolume"], [_takeSnapshotDecs, 2, "takeSnapshot"]], []).e;
|
|
194
197
|
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
195
198
|
_initProto = _applyDecs$e2[0];
|
|
196
199
|
_applyDecs$e;
|
|
@@ -24,12 +24,14 @@ import "core-js/modules/esnext.iterator.filter.js";
|
|
|
24
24
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
25
25
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
26
26
|
import { toLower } from '../../imports';
|
|
27
|
-
import {
|
|
27
|
+
import { createLogger } from '../utilities/logger';
|
|
28
28
|
export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
29
29
|
function AgoraRteServiceApi(_client, _appId, _region) {
|
|
30
30
|
var _pathIncludeRegion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
31
31
|
_classCallCheck(this, AgoraRteServiceApi);
|
|
32
|
-
_defineProperty(this, "logger",
|
|
32
|
+
_defineProperty(this, "logger", createLogger({
|
|
33
|
+
prefix: 'AgoraRteServiceApi'
|
|
34
|
+
}));
|
|
33
35
|
this._client = _client;
|
|
34
36
|
this._appId = _appId;
|
|
35
37
|
this._region = _region;
|
|
@@ -38,7 +40,7 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
38
40
|
if (_pathIncludeRegion) {
|
|
39
41
|
pathPrefix = "/".concat(toLower(_region)).concat(pathPrefix);
|
|
40
42
|
}
|
|
41
|
-
this.logger.info('
|
|
43
|
+
this.logger.info('set path prefix for RTE Service API:', pathPrefix);
|
|
42
44
|
this._pathPrefix = pathPrefix;
|
|
43
45
|
this._client.setPathPrefix(pathPrefix);
|
|
44
46
|
}
|
|
@@ -599,15 +601,51 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
599
601
|
return updateStream;
|
|
600
602
|
}()
|
|
601
603
|
}, {
|
|
602
|
-
key: "
|
|
604
|
+
key: "updateStreamWithToken",
|
|
603
605
|
value: function () {
|
|
604
|
-
var
|
|
605
|
-
var roomUuid,
|
|
606
|
+
var _updateStreamWithToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref12, token) {
|
|
607
|
+
var roomUuid, userUuid, streamUuid, videoSourceState, audioSourceState, videoSourceUuid, audioSourceUuid;
|
|
606
608
|
return _regeneratorRuntime.wrap(function (_context16) {
|
|
607
609
|
while (1) switch (_context16.prev = _context16.next) {
|
|
608
610
|
case 0:
|
|
609
|
-
roomUuid = _ref12.roomUuid,
|
|
611
|
+
roomUuid = _ref12.roomUuid, userUuid = _ref12.userUuid, streamUuid = _ref12.streamUuid, videoSourceState = _ref12.videoSourceState, audioSourceState = _ref12.audioSourceState, videoSourceUuid = _ref12.videoSourceUuid, audioSourceUuid = _ref12.audioSourceUuid;
|
|
610
612
|
_context16.next = 1;
|
|
613
|
+
return this._client.fetch({
|
|
614
|
+
path: "/v1/rooms/".concat(roomUuid, "/users/").concat(userUuid, "/streams/").concat(streamUuid),
|
|
615
|
+
method: 'PATCH',
|
|
616
|
+
data: {
|
|
617
|
+
videoSourceState: videoSourceState,
|
|
618
|
+
audioSourceState: audioSourceState,
|
|
619
|
+
videoSourceUuid: videoSourceUuid,
|
|
620
|
+
audioSourceUuid: audioSourceUuid
|
|
621
|
+
},
|
|
622
|
+
headers: {
|
|
623
|
+
token: token
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
case 1:
|
|
627
|
+
return _context16.abrupt("return", _context16.sent);
|
|
628
|
+
case 2:
|
|
629
|
+
case "end":
|
|
630
|
+
return _context16.stop();
|
|
631
|
+
}
|
|
632
|
+
}, _callee16, this);
|
|
633
|
+
}));
|
|
634
|
+
function updateStreamWithToken(_x20, _x21) {
|
|
635
|
+
return _updateStreamWithToken.apply(this, arguments);
|
|
636
|
+
}
|
|
637
|
+
return updateStreamWithToken;
|
|
638
|
+
}()
|
|
639
|
+
}, {
|
|
640
|
+
key: "sendRoomChatMessage",
|
|
641
|
+
value: function () {
|
|
642
|
+
var _sendRoomChatMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref13) {
|
|
643
|
+
var roomUuid, message, res;
|
|
644
|
+
return _regeneratorRuntime.wrap(function (_context17) {
|
|
645
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
646
|
+
case 0:
|
|
647
|
+
roomUuid = _ref13.roomUuid, message = _ref13.message;
|
|
648
|
+
_context17.next = 1;
|
|
611
649
|
return this._client.fetch({
|
|
612
650
|
path: "/v1/rooms/".concat(roomUuid, "/chat/channel"),
|
|
613
651
|
method: 'POST',
|
|
@@ -617,15 +655,15 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
617
655
|
}
|
|
618
656
|
});
|
|
619
657
|
case 1:
|
|
620
|
-
res =
|
|
621
|
-
return
|
|
658
|
+
res = _context17.sent;
|
|
659
|
+
return _context17.abrupt("return", res.data);
|
|
622
660
|
case 2:
|
|
623
661
|
case "end":
|
|
624
|
-
return
|
|
662
|
+
return _context17.stop();
|
|
625
663
|
}
|
|
626
|
-
},
|
|
664
|
+
}, _callee17, this);
|
|
627
665
|
}));
|
|
628
|
-
function sendRoomChatMessage(
|
|
666
|
+
function sendRoomChatMessage(_x22) {
|
|
629
667
|
return _sendRoomChatMessage.apply(this, arguments);
|
|
630
668
|
}
|
|
631
669
|
return sendRoomChatMessage;
|
|
@@ -633,13 +671,13 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
633
671
|
}, {
|
|
634
672
|
key: "sendCustomChannelMessage",
|
|
635
673
|
value: function () {
|
|
636
|
-
var _sendCustomChannelMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
637
|
-
var roomUuid, payload, cmd,
|
|
638
|
-
return _regeneratorRuntime.wrap(function (
|
|
639
|
-
while (1) switch (
|
|
674
|
+
var _sendCustomChannelMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref14) {
|
|
675
|
+
var roomUuid, payload, cmd, _ref14$sync, sync;
|
|
676
|
+
return _regeneratorRuntime.wrap(function (_context18) {
|
|
677
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
640
678
|
case 0:
|
|
641
|
-
roomUuid =
|
|
642
|
-
|
|
679
|
+
roomUuid = _ref14.roomUuid, payload = _ref14.payload, cmd = _ref14.cmd, _ref14$sync = _ref14.sync, sync = _ref14$sync === void 0 ? false : _ref14$sync;
|
|
680
|
+
_context18.next = 1;
|
|
643
681
|
return this._client.fetch({
|
|
644
682
|
path: "/v1/rooms/".concat(roomUuid, "/message/channel"),
|
|
645
683
|
method: 'POST',
|
|
@@ -652,14 +690,14 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
652
690
|
}
|
|
653
691
|
});
|
|
654
692
|
case 1:
|
|
655
|
-
return
|
|
693
|
+
return _context18.abrupt("return", _context18.sent);
|
|
656
694
|
case 2:
|
|
657
695
|
case "end":
|
|
658
|
-
return
|
|
696
|
+
return _context18.stop();
|
|
659
697
|
}
|
|
660
|
-
},
|
|
698
|
+
}, _callee18, this);
|
|
661
699
|
}));
|
|
662
|
-
function sendCustomChannelMessage(
|
|
700
|
+
function sendCustomChannelMessage(_x23) {
|
|
663
701
|
return _sendCustomChannelMessage.apply(this, arguments);
|
|
664
702
|
}
|
|
665
703
|
return sendCustomChannelMessage;
|
|
@@ -667,13 +705,13 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
667
705
|
}, {
|
|
668
706
|
key: "sendCustomPeerMessage",
|
|
669
707
|
value: function () {
|
|
670
|
-
var _sendCustomPeerMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
671
|
-
var payload, toUserUuid,
|
|
672
|
-
return _regeneratorRuntime.wrap(function (
|
|
673
|
-
while (1) switch (
|
|
708
|
+
var _sendCustomPeerMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref15) {
|
|
709
|
+
var payload, toUserUuid, _ref15$waitForAck, waitForAck;
|
|
710
|
+
return _regeneratorRuntime.wrap(function (_context19) {
|
|
711
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
674
712
|
case 0:
|
|
675
|
-
payload =
|
|
676
|
-
|
|
713
|
+
payload = _ref15.payload, toUserUuid = _ref15.toUserUuid, _ref15$waitForAck = _ref15.waitForAck, waitForAck = _ref15$waitForAck === void 0 ? false : _ref15$waitForAck;
|
|
714
|
+
_context19.next = 1;
|
|
677
715
|
return this._client.fetch({
|
|
678
716
|
path: "/v2/users/".concat(toUserUuid, "/messages/peer"),
|
|
679
717
|
method: 'POST',
|
|
@@ -683,14 +721,14 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
683
721
|
}
|
|
684
722
|
});
|
|
685
723
|
case 1:
|
|
686
|
-
return
|
|
724
|
+
return _context19.abrupt("return", _context19.sent);
|
|
687
725
|
case 2:
|
|
688
726
|
case "end":
|
|
689
|
-
return
|
|
727
|
+
return _context19.stop();
|
|
690
728
|
}
|
|
691
|
-
},
|
|
729
|
+
}, _callee19, this);
|
|
692
730
|
}));
|
|
693
|
-
function sendCustomPeerMessage(
|
|
731
|
+
function sendCustomPeerMessage(_x24) {
|
|
694
732
|
return _sendCustomPeerMessage.apply(this, arguments);
|
|
695
733
|
}
|
|
696
734
|
return sendCustomPeerMessage;
|
|
@@ -698,26 +736,26 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
698
736
|
}, {
|
|
699
737
|
key: "updateOnlineState",
|
|
700
738
|
value: function () {
|
|
701
|
-
var _updateOnlineState = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
739
|
+
var _updateOnlineState = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref16) {
|
|
702
740
|
var userUuid, roomUuid;
|
|
703
|
-
return _regeneratorRuntime.wrap(function (
|
|
704
|
-
while (1) switch (
|
|
741
|
+
return _regeneratorRuntime.wrap(function (_context20) {
|
|
742
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
705
743
|
case 0:
|
|
706
|
-
userUuid =
|
|
707
|
-
|
|
744
|
+
userUuid = _ref16.userUuid, roomUuid = _ref16.roomUuid;
|
|
745
|
+
_context20.next = 1;
|
|
708
746
|
return this._client.fetch({
|
|
709
747
|
path: "/v1/rooms/".concat(roomUuid, "/users/").concat(userUuid, "/states/1"),
|
|
710
748
|
method: 'PUT'
|
|
711
749
|
});
|
|
712
750
|
case 1:
|
|
713
|
-
return
|
|
751
|
+
return _context20.abrupt("return", _context20.sent);
|
|
714
752
|
case 2:
|
|
715
753
|
case "end":
|
|
716
|
-
return
|
|
754
|
+
return _context20.stop();
|
|
717
755
|
}
|
|
718
|
-
},
|
|
756
|
+
}, _callee20, this);
|
|
719
757
|
}));
|
|
720
|
-
function updateOnlineState(
|
|
758
|
+
function updateOnlineState(_x25) {
|
|
721
759
|
return _updateOnlineState.apply(this, arguments);
|
|
722
760
|
}
|
|
723
761
|
return updateOnlineState;
|
|
@@ -725,13 +763,13 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
725
763
|
}, {
|
|
726
764
|
key: "fetchUserList",
|
|
727
765
|
value: function () {
|
|
728
|
-
var _fetchUserList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
766
|
+
var _fetchUserList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref17) {
|
|
729
767
|
var userRole, pageIndex, pageSize, roomId, userIds, excludeResponse;
|
|
730
|
-
return _regeneratorRuntime.wrap(function (
|
|
731
|
-
while (1) switch (
|
|
768
|
+
return _regeneratorRuntime.wrap(function (_context21) {
|
|
769
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
732
770
|
case 0:
|
|
733
|
-
userRole =
|
|
734
|
-
|
|
771
|
+
userRole = _ref17.userRole, pageIndex = _ref17.pageIndex, pageSize = _ref17.pageSize, roomId = _ref17.roomId, userIds = _ref17.userIds, excludeResponse = _ref17.excludeResponse;
|
|
772
|
+
_context21.next = 1;
|
|
735
773
|
return this._client.fetch({
|
|
736
774
|
path: "/v2/rooms/".concat(roomId, "/users/page"),
|
|
737
775
|
method: 'GET',
|
|
@@ -744,14 +782,14 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
744
782
|
}
|
|
745
783
|
});
|
|
746
784
|
case 1:
|
|
747
|
-
return
|
|
785
|
+
return _context21.abrupt("return", _context21.sent);
|
|
748
786
|
case 2:
|
|
749
787
|
case "end":
|
|
750
|
-
return
|
|
788
|
+
return _context21.stop();
|
|
751
789
|
}
|
|
752
|
-
},
|
|
790
|
+
}, _callee21, this);
|
|
753
791
|
}));
|
|
754
|
-
function fetchUserList(
|
|
792
|
+
function fetchUserList(_x26) {
|
|
755
793
|
return _fetchUserList.apply(this, arguments);
|
|
756
794
|
}
|
|
757
795
|
return fetchUserList;
|
|
@@ -759,13 +797,13 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
759
797
|
}, {
|
|
760
798
|
key: "uploadEvent",
|
|
761
799
|
value: function () {
|
|
762
|
-
var _uploadEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
800
|
+
var _uploadEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref18) {
|
|
763
801
|
var userId, event;
|
|
764
|
-
return _regeneratorRuntime.wrap(function (
|
|
765
|
-
while (1) switch (
|
|
802
|
+
return _regeneratorRuntime.wrap(function (_context22) {
|
|
803
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
766
804
|
case 0:
|
|
767
|
-
userId =
|
|
768
|
-
|
|
805
|
+
userId = _ref18.userId, event = _ref18.event;
|
|
806
|
+
_context22.next = 1;
|
|
769
807
|
return this._client.fetch({
|
|
770
808
|
path: "/v1/users/".concat(userId, "/client/events"),
|
|
771
809
|
method: 'POST',
|
|
@@ -776,14 +814,14 @@ export var AgoraRteServiceApi = /*#__PURE__*/function () {
|
|
|
776
814
|
}
|
|
777
815
|
});
|
|
778
816
|
case 1:
|
|
779
|
-
return
|
|
817
|
+
return _context22.abrupt("return", _context22.sent);
|
|
780
818
|
case 2:
|
|
781
819
|
case "end":
|
|
782
|
-
return
|
|
820
|
+
return _context22.stop();
|
|
783
821
|
}
|
|
784
|
-
},
|
|
822
|
+
}, _callee22, this);
|
|
785
823
|
}));
|
|
786
|
-
function uploadEvent(
|
|
824
|
+
function uploadEvent(_x27) {
|
|
787
825
|
return _uploadEvent.apply(this, arguments);
|
|
788
826
|
}
|
|
789
827
|
return uploadEvent;
|
|
@@ -18,11 +18,14 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
18
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
20
|
import { HTTP_HEADER_K_AGORA_TOKEN, HTTP_HEADER_K_AGORA_UID, HTTP_HEADER_K_AUTHORIZATION } from '../utilities/constants';
|
|
21
|
+
export var getAuthorization = function getAuthorization(token) {
|
|
22
|
+
return "agora token=\"".concat(token, "\"");
|
|
23
|
+
};
|
|
21
24
|
export var AgoraHttpAuthHeadersProviderImpl = /*#__PURE__*/function () {
|
|
22
25
|
function AgoraHttpAuthHeadersProviderImpl(auth) {
|
|
23
26
|
_classCallCheck(this, AgoraHttpAuthHeadersProviderImpl);
|
|
24
27
|
_defineProperty(this, "_headers", {});
|
|
25
|
-
this._headers = _defineProperty(_defineProperty(_defineProperty({}, HTTP_HEADER_K_AGORA_TOKEN, auth.token), HTTP_HEADER_K_AGORA_UID, auth.userId), HTTP_HEADER_K_AUTHORIZATION,
|
|
28
|
+
this._headers = _defineProperty(_defineProperty(_defineProperty({}, HTTP_HEADER_K_AGORA_TOKEN, auth.token), HTTP_HEADER_K_AGORA_UID, auth.userId), HTTP_HEADER_K_AUTHORIZATION, getAuthorization(auth.token));
|
|
26
29
|
}
|
|
27
30
|
return _createClass(AgoraHttpAuthHeadersProviderImpl, [{
|
|
28
31
|
key: "clone",
|
|
@@ -7,9 +7,12 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
8
8
|
import "core-js/modules/es.error.cause.js";
|
|
9
9
|
import "core-js/modules/es.error.to-string.js";
|
|
10
|
+
import "core-js/modules/es.array.concat.js";
|
|
10
11
|
import "core-js/modules/es.function.name.js";
|
|
11
12
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
+
import { DetailErrorCode, ErrorModuleCode } from '../../imports';
|
|
15
|
+
import { generateRteClientErrorNew, generateRteServerErrorNew } from '../utilities/error';
|
|
13
16
|
export var AgoraRestfulClientError = /*#__PURE__*/function (_Error) {
|
|
14
17
|
function AgoraRestfulClientError(_httpCode, _message) {
|
|
15
18
|
var _this;
|
|
@@ -46,4 +49,13 @@ export var AgoraRestfulClientError = /*#__PURE__*/function (_Error) {
|
|
|
46
49
|
return (_this$_opts2 = this._opts) === null || _this$_opts2 === void 0 ? void 0 : _this$_opts2.origin;
|
|
47
50
|
}
|
|
48
51
|
}]);
|
|
49
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
52
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
53
|
+
export var isRestfulError = function isRestfulError(err) {
|
|
54
|
+
return err instanceof AgoraRestfulClientError;
|
|
55
|
+
};
|
|
56
|
+
export var wrapRestfulErrorAsRteError = function wrapRestfulErrorAsRteError(err, prefix) {
|
|
57
|
+
var _err$serviceCode;
|
|
58
|
+
var msg = "".concat(prefix, ", ").concat(err.message);
|
|
59
|
+
var isLocal = err.httpCode < 100;
|
|
60
|
+
return isLocal ? generateRteClientErrorNew(ErrorModuleCode.RTE_ENGINE, DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, msg) : generateRteServerErrorNew((_err$serviceCode = err.serviceCode) !== null && _err$serviceCode !== void 0 ? _err$serviceCode : -1, msg);
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import "core-js/modules/es.array.for-each.js";
|
|
8
|
+
import "core-js/modules/es.array.iterator.js";
|
|
9
|
+
import "core-js/modules/es.object.to-string.js";
|
|
10
|
+
import "core-js/modules/es.promise.js";
|
|
11
|
+
import "core-js/modules/es.set.js";
|
|
12
|
+
import "core-js/modules/es.string.iterator.js";
|
|
13
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
14
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
15
|
+
import "core-js/modules/esnext.set.add-all.js";
|
|
16
|
+
import "core-js/modules/esnext.set.delete-all.js";
|
|
17
|
+
import "core-js/modules/esnext.set.difference.v2.js";
|
|
18
|
+
import "core-js/modules/esnext.set.difference.js";
|
|
19
|
+
import "core-js/modules/esnext.set.every.js";
|
|
20
|
+
import "core-js/modules/esnext.set.filter.js";
|
|
21
|
+
import "core-js/modules/esnext.set.find.js";
|
|
22
|
+
import "core-js/modules/esnext.set.intersection.v2.js";
|
|
23
|
+
import "core-js/modules/esnext.set.intersection.js";
|
|
24
|
+
import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
|
|
25
|
+
import "core-js/modules/esnext.set.is-disjoint-from.js";
|
|
26
|
+
import "core-js/modules/esnext.set.is-subset-of.v2.js";
|
|
27
|
+
import "core-js/modules/esnext.set.is-subset-of.js";
|
|
28
|
+
import "core-js/modules/esnext.set.is-superset-of.v2.js";
|
|
29
|
+
import "core-js/modules/esnext.set.is-superset-of.js";
|
|
30
|
+
import "core-js/modules/esnext.set.join.js";
|
|
31
|
+
import "core-js/modules/esnext.set.map.js";
|
|
32
|
+
import "core-js/modules/esnext.set.reduce.js";
|
|
33
|
+
import "core-js/modules/esnext.set.some.js";
|
|
34
|
+
import "core-js/modules/esnext.set.symmetric-difference.v2.js";
|
|
35
|
+
import "core-js/modules/esnext.set.symmetric-difference.js";
|
|
36
|
+
import "core-js/modules/esnext.set.union.v2.js";
|
|
37
|
+
import "core-js/modules/esnext.set.union.js";
|
|
38
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
39
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
40
|
+
import { DetailErrorCode, ErrorModuleCode } from '../../imports';
|
|
41
|
+
import { AgoraRteError, generateRteClientErrorNew } from './error';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* AbortManager manages abortable operations.
|
|
45
|
+
* 为异步函数提供中止管理功能。
|
|
46
|
+
*/
|
|
47
|
+
export var AbortManager = /*#__PURE__*/function () {
|
|
48
|
+
function AbortManager() {
|
|
49
|
+
_classCallCheck(this, AbortManager);
|
|
50
|
+
_defineProperty(this, "_aborted", false);
|
|
51
|
+
_defineProperty(this, "_waiters", new Set());
|
|
52
|
+
}
|
|
53
|
+
return _createClass(AbortManager, [{
|
|
54
|
+
key: "isAborted",
|
|
55
|
+
get: function get() {
|
|
56
|
+
return this._aborted;
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "reason",
|
|
60
|
+
get: function get() {
|
|
61
|
+
return this._reason;
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "manage",
|
|
65
|
+
value: function manage(fn) {
|
|
66
|
+
var _this = this;
|
|
67
|
+
return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
68
|
+
var onAbort,
|
|
69
|
+
abortPromise,
|
|
70
|
+
_len,
|
|
71
|
+
args,
|
|
72
|
+
_key,
|
|
73
|
+
result,
|
|
74
|
+
_args = arguments;
|
|
75
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
76
|
+
while (1) switch (_context.prev = _context.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
_this.checkAborted();
|
|
79
|
+
abortPromise = new Promise(function (_, reject) {
|
|
80
|
+
onAbort = function onAbort(error) {
|
|
81
|
+
return reject(error);
|
|
82
|
+
};
|
|
83
|
+
_this._waiters.add(onAbort);
|
|
84
|
+
});
|
|
85
|
+
_context.prev = 1;
|
|
86
|
+
for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
87
|
+
args[_key] = _args[_key];
|
|
88
|
+
}
|
|
89
|
+
_context.next = 2;
|
|
90
|
+
return Promise.race([Promise.resolve(fn.apply(void 0, _toConsumableArray(args))), abortPromise]);
|
|
91
|
+
case 2:
|
|
92
|
+
result = _context.sent;
|
|
93
|
+
_this.checkAborted();
|
|
94
|
+
return _context.abrupt("return", result);
|
|
95
|
+
case 3:
|
|
96
|
+
_context.prev = 3;
|
|
97
|
+
if (onAbort) {
|
|
98
|
+
_this._waiters["delete"](onAbort);
|
|
99
|
+
}
|
|
100
|
+
return _context.finish(3);
|
|
101
|
+
case 4:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee, null, [[1,, 3, 4]]);
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "abort",
|
|
110
|
+
value: function abort(reason) {
|
|
111
|
+
if (this._aborted) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var abortError = generateRteClientErrorNew(ErrorModuleCode.RTE_SCENE, DetailErrorCode.JOIN_FAILED, reason || 'Operation was aborted');
|
|
115
|
+
this._aborted = true;
|
|
116
|
+
this._reason = abortError;
|
|
117
|
+
this._waiters.forEach(function (reject) {
|
|
118
|
+
return reject(abortError);
|
|
119
|
+
});
|
|
120
|
+
this._waiters.clear();
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "reset",
|
|
124
|
+
value: function reset() {
|
|
125
|
+
this._aborted = false;
|
|
126
|
+
this._reason = undefined;
|
|
127
|
+
this._waiters.clear();
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "checkAborted",
|
|
131
|
+
value: function checkAborted() {
|
|
132
|
+
if (this._aborted && this._reason) {
|
|
133
|
+
throw this._reason;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}], [{
|
|
137
|
+
key: "create",
|
|
138
|
+
value: function create() {
|
|
139
|
+
return new AbortManager();
|
|
140
|
+
}
|
|
141
|
+
}]);
|
|
142
|
+
}();
|
|
143
|
+
export function isAbortError(error) {
|
|
144
|
+
var ABORT_ERROR_CODE = generateRteClientErrorNew(ErrorModuleCode.RTE_SCENE, DetailErrorCode.JOIN_FAILED, '').code;
|
|
145
|
+
return error instanceof AgoraRteError && error.code === ABORT_ERROR_CODE;
|
|
146
|
+
}
|