agora-rte-sdk 3.7.8-rc.2 → 3.7.8-rc.3
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/plugin/rtc/web/device.d.ts +4 -2
- package/lib/plugin/rtc/web/device.js +17 -5
- package/lib/plugin/rtc/web/publish.d.ts +6 -10
- package/lib/plugin/rtc/web/publish.js +10 -22
- package/lib/plugin/rtc/web/publisher.d.ts +9 -2
- package/lib/plugin/rtc/web/publisher.js +72 -3
- package/lib/plugin/rtc/web/type.d.ts +10 -0
- package/package.json +3 -3
|
@@ -12,8 +12,10 @@ export declare class AgoraRtcDeviceManager {
|
|
|
12
12
|
constructor(_extensionDelegate: AgoraWebRtcExtensionDelegate, _dualCameraVideoStreamConfig: AgoraRteDualVideoStreamConfig, _dualScreenVideoStreamConfig: AgoraRteDualVideoStreamConfig);
|
|
13
13
|
get keepRecording(): boolean;
|
|
14
14
|
setKeepAudioRecording(keepRecording: boolean): void;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
getCameraVideoTracksMap(): Map<string, ILocalVideoTrack>;
|
|
16
|
+
getScreenVideoTracksMap(): Map<string, ILocalVideoTrack>;
|
|
17
|
+
getMicrophoneAudioTracksMap(): Map<string, ILocalAudioTrack>;
|
|
18
|
+
getScreenAudioTracksMap(): Map<string, ILocalAudioTrack>;
|
|
17
19
|
getVideoDeviceStateMap(): Map<string, {
|
|
18
20
|
started: boolean;
|
|
19
21
|
}>;
|
|
@@ -88,7 +88,7 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
|
|
|
88
88
|
_agoraRtcSdkNg["default"].on('playback-device-changed', this._handleSpeakerChanged);
|
|
89
89
|
this._mediaDeviceStateUpdater = new AgoraMediaDeviceStateUpdater(this._localTrackObservable, this._observable);
|
|
90
90
|
_agoraRtcSdkNg["default"].registerExtensions(_extensionDelegate.getExtensions());
|
|
91
|
-
this._localTrackObservable.addObserver((0, _logger2.generateLogObserver)(this.logger, ['onLocalVideoTrackBeforeCreate', 'onLocalVideoTrackCreated', 'onLocalVideoTrackFailedToCreate', 'onLocalVideoTrackBeforeDestroy']));
|
|
91
|
+
this._localTrackObservable.addObserver((0, _logger2.generateLogObserver)(this.logger, ['onLocalVideoTrackBeforeCreate', 'onLocalVideoTrackCreated', 'onLocalVideoTrackFailedToCreate', 'onLocalVideoTrackBeforeDestroy', 'onVideoDeviceStateFlagUpdated', 'onLocalAudioTrackBeforeCreate', 'onLocalAudioTrackCreated', 'onLocalAudioTrackFailedToCreate', 'onLocalAudioTrackBeforeDestroy', 'onAudioDeviceStateFlagUpdated']));
|
|
92
92
|
}
|
|
93
93
|
return (0, _createClass2["default"])(AgoraRtcDeviceManager, [{
|
|
94
94
|
key: "keepRecording",
|
|
@@ -104,14 +104,20 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
}, {
|
|
107
|
-
key: "
|
|
108
|
-
value: function
|
|
107
|
+
key: "getCameraVideoTracksMap",
|
|
108
|
+
value: function getCameraVideoTracksMap() {
|
|
109
109
|
var map = new Map();
|
|
110
110
|
this._cameraControls.forEach(function (control) {
|
|
111
111
|
if (control.videoTrack) {
|
|
112
112
|
map.set(control.deviceId, control.videoTrack);
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
|
+
return map;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "getScreenVideoTracksMap",
|
|
119
|
+
value: function getScreenVideoTracksMap() {
|
|
120
|
+
var map = new Map();
|
|
115
121
|
this._screenControls.forEach(function (control) {
|
|
116
122
|
if (control.videoTrack) {
|
|
117
123
|
map.set(control.sourceId, control.videoTrack);
|
|
@@ -120,14 +126,20 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
|
|
|
120
126
|
return map;
|
|
121
127
|
}
|
|
122
128
|
}, {
|
|
123
|
-
key: "
|
|
124
|
-
value: function
|
|
129
|
+
key: "getMicrophoneAudioTracksMap",
|
|
130
|
+
value: function getMicrophoneAudioTracksMap() {
|
|
125
131
|
var map = new Map();
|
|
126
132
|
this._microphoneControls.forEach(function (control) {
|
|
127
133
|
if (control.audioTrack) {
|
|
128
134
|
map.set(control.deviceId, control.audioTrack);
|
|
129
135
|
}
|
|
130
136
|
});
|
|
137
|
+
return map;
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "getScreenAudioTracksMap",
|
|
141
|
+
value: function getScreenAudioTracksMap() {
|
|
142
|
+
var map = new Map();
|
|
131
143
|
this._screenControls.forEach(function (control) {
|
|
132
144
|
if (control.audioTrack) {
|
|
133
145
|
map.set(control.sourceId, control.audioTrack);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { IAgoraRTCClient, ILocalAudioTrack, ILocalVideoTrack } from 'agora-rtc-sdk-ng';
|
|
2
|
-
import {
|
|
3
|
-
import { AgoraRtcAudioSourceType, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoSourceType } from '../../../core/rtc/type';
|
|
4
|
-
import { AgoraObservable } from 'agora-foundation/lib/utilities/observable';
|
|
2
|
+
import { AgoraRtcVideoEncoderConfiguration } from '../../../core/rtc/type';
|
|
5
3
|
export declare class AgoraRtcPublishManager {
|
|
6
4
|
private _mode;
|
|
7
5
|
private _rtcClient;
|
|
8
|
-
private _localTrackObservable;
|
|
9
6
|
/**
|
|
10
7
|
* local camera state by device id
|
|
11
8
|
*/
|
|
@@ -29,8 +26,7 @@ export declare class AgoraRtcPublishManager {
|
|
|
29
26
|
private _audioPublishMap;
|
|
30
27
|
private _videoEncoderConfigMap;
|
|
31
28
|
private _isProcessing;
|
|
32
|
-
|
|
33
|
-
constructor(_mode: 'live' | 'rtc', _rtcClient: IAgoraRTCClient, _localTrackObservable: AgoraObservable<AgoraRtcLocalTrackEventsObserver>,
|
|
29
|
+
constructor(_mode: 'live' | 'rtc', _rtcClient: IAgoraRTCClient,
|
|
34
30
|
/**
|
|
35
31
|
* local camera state by device id
|
|
36
32
|
*/
|
|
@@ -51,10 +47,10 @@ export declare class AgoraRtcPublishManager {
|
|
|
51
47
|
* local tracks mapped by source id
|
|
52
48
|
*/
|
|
53
49
|
_localAudioTracks?: Map<string, ILocalAudioTrack>);
|
|
54
|
-
onLocalVideoTrackCreated(sourceId: string,
|
|
55
|
-
onLocalVideoTrackBeforeDestroy(sourceId: string,
|
|
56
|
-
onLocalAudioTrackCreated(sourceId: string,
|
|
57
|
-
onLocalAudioTrackBeforeDestroy(sourceId: string,
|
|
50
|
+
onLocalVideoTrackCreated(sourceId: string, localTrack: ILocalVideoTrack): void;
|
|
51
|
+
onLocalVideoTrackBeforeDestroy(sourceId: string, localTrack: ILocalVideoTrack): void;
|
|
52
|
+
onLocalAudioTrackCreated(sourceId: string, localTrack: ILocalAudioTrack): void;
|
|
53
|
+
onLocalAudioTrackBeforeDestroy(sourceId: string, localTrack: ILocalAudioTrack): void;
|
|
58
54
|
onVideoDeviceStateFlagUpdated(deviceId: string, flag: number): void;
|
|
59
55
|
onAudioDeviceStateFlagUpdated(deviceId: string, flag: number): void;
|
|
60
56
|
publishVideo(streamId: string, sourceId: string): void;
|
|
@@ -110,11 +110,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
110
110
|
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; }
|
|
111
111
|
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; }
|
|
112
112
|
var AgoraRtcPublishManager = exports.AgoraRtcPublishManager = /*#__PURE__*/function () {
|
|
113
|
-
function AgoraRtcPublishManager(_mode, _rtcClient
|
|
114
|
-
var _videoDeviceStateMap = arguments.length >
|
|
115
|
-
var _audioDeviceStateMap = arguments.length >
|
|
116
|
-
var _localVideoTracks = arguments.length >
|
|
117
|
-
var _localAudioTracks = arguments.length >
|
|
113
|
+
function AgoraRtcPublishManager(_mode, _rtcClient) {
|
|
114
|
+
var _videoDeviceStateMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Map();
|
|
115
|
+
var _audioDeviceStateMap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Map();
|
|
116
|
+
var _localVideoTracks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new Map();
|
|
117
|
+
var _localAudioTracks = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new Map();
|
|
118
118
|
(0, _classCallCheck2["default"])(this, AgoraRtcPublishManager);
|
|
119
119
|
(0, _defineProperty2["default"])(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
120
120
|
prefix: 'AgoraRtcPublishManager'
|
|
@@ -127,46 +127,36 @@ var AgoraRtcPublishManager = exports.AgoraRtcPublishManager = /*#__PURE__*/funct
|
|
|
127
127
|
(0, _defineProperty2["default"])(this, "_isProcessing", false);
|
|
128
128
|
this._mode = _mode;
|
|
129
129
|
this._rtcClient = _rtcClient;
|
|
130
|
-
this._localTrackObservable = _localTrackObservable;
|
|
131
130
|
this._videoDeviceStateMap = _videoDeviceStateMap;
|
|
132
131
|
this._audioDeviceStateMap = _audioDeviceStateMap;
|
|
133
132
|
this._localVideoTracks = _localVideoTracks;
|
|
134
133
|
this._localAudioTracks = _localAudioTracks;
|
|
135
134
|
this._syncState = this._syncState.bind(this);
|
|
136
|
-
this._trackObserver = {
|
|
137
|
-
onLocalVideoTrackCreated: this.onLocalVideoTrackCreated.bind(this),
|
|
138
|
-
onLocalVideoTrackBeforeDestroy: this.onLocalVideoTrackBeforeDestroy.bind(this),
|
|
139
|
-
onLocalAudioTrackCreated: this.onLocalAudioTrackCreated.bind(this),
|
|
140
|
-
onLocalAudioTrackBeforeDestroy: this.onLocalAudioTrackBeforeDestroy.bind(this),
|
|
141
|
-
onVideoDeviceStateFlagUpdated: this.onVideoDeviceStateFlagUpdated.bind(this),
|
|
142
|
-
onAudioDeviceStateFlagUpdated: this.onAudioDeviceStateFlagUpdated.bind(this)
|
|
143
|
-
};
|
|
144
|
-
this._localTrackObservable.addObserver(this._trackObserver);
|
|
145
135
|
this._rtcClient.on('connection-state-change', this._handleRtcConnectionStateChange.bind(this));
|
|
146
136
|
}
|
|
147
137
|
return (0, _createClass2["default"])(AgoraRtcPublishManager, [{
|
|
148
138
|
key: "onLocalVideoTrackCreated",
|
|
149
|
-
value: function onLocalVideoTrackCreated(sourceId,
|
|
139
|
+
value: function onLocalVideoTrackCreated(sourceId, localTrack) {
|
|
150
140
|
this._localVideoTracks.set(sourceId, localTrack);
|
|
151
141
|
this._applyVideoEncoderConfig();
|
|
152
142
|
this._syncState();
|
|
153
143
|
}
|
|
154
144
|
}, {
|
|
155
145
|
key: "onLocalVideoTrackBeforeDestroy",
|
|
156
|
-
value: function onLocalVideoTrackBeforeDestroy(sourceId,
|
|
146
|
+
value: function onLocalVideoTrackBeforeDestroy(sourceId, localTrack) {
|
|
157
147
|
this._localVideoTracks["delete"](sourceId);
|
|
158
148
|
this._destroyedLocalVideoTracks.set(sourceId, localTrack);
|
|
159
149
|
this._syncState();
|
|
160
150
|
}
|
|
161
151
|
}, {
|
|
162
152
|
key: "onLocalAudioTrackCreated",
|
|
163
|
-
value: function onLocalAudioTrackCreated(sourceId,
|
|
153
|
+
value: function onLocalAudioTrackCreated(sourceId, localTrack) {
|
|
164
154
|
this._localAudioTracks.set(sourceId, localTrack);
|
|
165
155
|
this._syncState();
|
|
166
156
|
}
|
|
167
157
|
}, {
|
|
168
158
|
key: "onLocalAudioTrackBeforeDestroy",
|
|
169
|
-
value: function onLocalAudioTrackBeforeDestroy(sourceId,
|
|
159
|
+
value: function onLocalAudioTrackBeforeDestroy(sourceId, localTrack) {
|
|
170
160
|
this._localAudioTracks["delete"](sourceId);
|
|
171
161
|
this._destroyedLocalAudioTracks.set(sourceId, localTrack);
|
|
172
162
|
this._syncState();
|
|
@@ -231,9 +221,7 @@ var AgoraRtcPublishManager = exports.AgoraRtcPublishManager = /*#__PURE__*/funct
|
|
|
231
221
|
}
|
|
232
222
|
}, {
|
|
233
223
|
key: "release",
|
|
234
|
-
value: function release() {
|
|
235
|
-
this._localTrackObservable.removeObserver(this._trackObserver);
|
|
236
|
-
}
|
|
224
|
+
value: function release() {}
|
|
237
225
|
}, {
|
|
238
226
|
key: "setVideoEncoderConfig",
|
|
239
227
|
value: function setVideoEncoderConfig(streamId, config) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IAgoraRTCClient } from 'agora-rtc-sdk-ng';
|
|
1
|
+
import { IAgoraRTCClient, ILocalAudioTrack, ILocalVideoTrack } from 'agora-rtc-sdk-ng';
|
|
2
2
|
import { AgoraRtcChannelPublisher } from '../../../core/rtc/publisher';
|
|
3
3
|
import { AgoraRtcSourceManager } from '../../../core/rtc/source-manager';
|
|
4
|
-
import { AgoraRtcChannelClientObserver, AgoraRtcConnection, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoStreamType, AgoraRtcScreenScenarioType, AgoraRtcChannelPublisherObserver } from '../../../core/rtc/type';
|
|
4
|
+
import { AgoraRtcAudioSourceType, AgoraRtcChannelClientObserver, AgoraRtcConnection, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoSourceType, AgoraRtcVideoStreamType, AgoraRtcScreenScenarioType, AgoraRtcChannelPublisherObserver } from '../../../core/rtc/type';
|
|
5
5
|
import { AgoraRteVideoSourceType, AgoraRteAudioSourceType } from '../../../type';
|
|
6
6
|
import { AgoraWebRtcStreamPublishPoolImpl } from './publish-pool';
|
|
7
7
|
import { AgoraWebRtcChannelClientInitConfig } from './type';
|
|
@@ -22,10 +22,17 @@ export declare class AgoraRtcChannelPublisherImpl extends AgoraRtcChannelPublish
|
|
|
22
22
|
private _defaultCameraHighVideoEncoderConfig;
|
|
23
23
|
private _defaultCameraLowVideoEncoderConfig;
|
|
24
24
|
private _defaultScreenVideoEncoderConfig;
|
|
25
|
+
private _localTrackObserver;
|
|
25
26
|
publishPool: AgoraWebRtcStreamPublishPoolImpl;
|
|
26
27
|
private _sourceManagerObserver;
|
|
27
28
|
private _publishPoolObserver;
|
|
28
29
|
constructor(mainConnection: AgoraRtcConnection, sourceManager: AgoraRtcSourceManager, _rtcClient: IAgoraRTCClient, _initConfig: AgoraWebRtcChannelClientInitConfig, _deviceManager: AgoraRtcDeviceManager, _channelObservable: AgoraObservable<AgoraRtcChannelClientObserver>);
|
|
30
|
+
onLocalVideoTrackCreated(sourceId: string, sourceType: AgoraRtcVideoSourceType, localTrack: ILocalVideoTrack): void;
|
|
31
|
+
onLocalVideoTrackBeforeDestroy(sourceId: string, sourceType: AgoraRtcVideoSourceType, localTrack: ILocalVideoTrack): void;
|
|
32
|
+
onLocalAudioTrackCreated(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
|
|
33
|
+
onLocalAudioTrackBeforeDestroy(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
|
|
34
|
+
onVideoDeviceStateFlagUpdated(deviceId: string, flag: number): void;
|
|
35
|
+
onAudioDeviceStateFlagUpdated(deviceId: string, flag: number): void;
|
|
29
36
|
release(): void;
|
|
30
37
|
publishLocalVideoStream(token: string | undefined, streamId: string, sourceId: string, type: AgoraRteVideoSourceType): number;
|
|
31
38
|
unpublishLocalVideoStream(streamId: string, type: AgoraRteVideoSourceType): number;
|
|
@@ -86,7 +86,7 @@ function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.descr
|
|
|
86
86
|
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; }
|
|
87
87
|
var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__PURE__*/function (_AgoraRtcChannelPubli) {
|
|
88
88
|
function AgoraRtcChannelPublisherImpl(mainConnection, sourceManager, _rtcClient, _initConfig, _deviceManager, _channelObservable) {
|
|
89
|
-
var _this$_initConfig$opt, _this$_initConfig$opt2;
|
|
89
|
+
var _this$onVideoDeviceSt, _this$onAudioDeviceSt, _this$_initConfig$opt, _this$_initConfig$opt2;
|
|
90
90
|
var _this;
|
|
91
91
|
(0, _classCallCheck2["default"])(this, AgoraRtcChannelPublisherImpl);
|
|
92
92
|
_this = _callSuper(this, AgoraRtcChannelPublisherImpl);
|
|
@@ -99,6 +99,14 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
|
|
|
99
99
|
(0, _defineProperty2["default"])(_this, "_publishManagerBinderMap", new Map());
|
|
100
100
|
(0, _defineProperty2["default"])(_this, "_publishVideoMapping", new Map());
|
|
101
101
|
(0, _defineProperty2["default"])(_this, "_publishAudioMapping", new Map());
|
|
102
|
+
(0, _defineProperty2["default"])(_this, "_localTrackObserver", {
|
|
103
|
+
onLocalVideoTrackCreated: _this.onLocalVideoTrackCreated.bind(_this),
|
|
104
|
+
onLocalVideoTrackBeforeDestroy: _this.onLocalVideoTrackBeforeDestroy.bind(_this),
|
|
105
|
+
onLocalAudioTrackCreated: _this.onLocalAudioTrackCreated.bind(_this),
|
|
106
|
+
onLocalAudioTrackBeforeDestroy: _this.onLocalAudioTrackBeforeDestroy.bind(_this),
|
|
107
|
+
onVideoDeviceStateFlagUpdated: (_this$onVideoDeviceSt = _this.onVideoDeviceStateFlagUpdated) === null || _this$onVideoDeviceSt === void 0 ? void 0 : _this$onVideoDeviceSt.bind(_this),
|
|
108
|
+
onAudioDeviceStateFlagUpdated: (_this$onAudioDeviceSt = _this.onAudioDeviceStateFlagUpdated) === null || _this$onAudioDeviceSt === void 0 ? void 0 : _this$onAudioDeviceSt.bind(_this)
|
|
109
|
+
});
|
|
102
110
|
(0, _defineProperty2["default"])(_this, "_sourceManagerObserver", {
|
|
103
111
|
onCameraStateUpdated: function onCameraStateUpdated(deivceId, state) {
|
|
104
112
|
_this.publishPool.updateVideoSource(deivceId, _type4.AgoraRtcVideoSourceType.CAMERA, state);
|
|
@@ -197,18 +205,74 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
|
|
|
197
205
|
_this._channelObservable = _channelObservable;
|
|
198
206
|
_this.sourceManager = sourceManager;
|
|
199
207
|
_this.publishPool = new _publishPool.AgoraWebRtcStreamPublishPoolImpl(mainConnection);
|
|
200
|
-
_this._mainPublishManager = new _publish.AgoraRtcPublishManager((_this$_initConfig$opt = (_this$_initConfig$opt2 = _this._initConfig.options) === null || _this$_initConfig$opt2 === void 0 ? void 0 : _this$_initConfig$opt2.mode) !== null && _this$_initConfig$opt !== void 0 ? _this$_initConfig$opt : 'live', _this._rtcClient, _this._deviceManager.
|
|
208
|
+
_this._mainPublishManager = new _publish.AgoraRtcPublishManager((_this$_initConfig$opt = (_this$_initConfig$opt2 = _this._initConfig.options) === null || _this$_initConfig$opt2 === void 0 ? void 0 : _this$_initConfig$opt2.mode) !== null && _this$_initConfig$opt !== void 0 ? _this$_initConfig$opt : 'live', _this._rtcClient, _this._deviceManager.getVideoDeviceStateMap(), _this._deviceManager.getAudioDeviceStateMap(), _this._deviceManager.getCameraVideoTracksMap(), _this._deviceManager.getMicrophoneAudioTracksMap());
|
|
201
209
|
_this.sourceManager.addObserver(_this._sourceManagerObserver);
|
|
202
210
|
_this.publishPool.addObserver(_this._publishPoolObserver);
|
|
203
211
|
_this._defaultCameraHighVideoEncoderConfig = _initConfig.dualCameraVideoStreamConfig.highVideoEncoderConfig;
|
|
204
212
|
_this._defaultCameraLowVideoEncoderConfig = _initConfig.dualCameraVideoStreamConfig.lowVideoEncoderConfig;
|
|
205
213
|
_this._defaultScreenVideoEncoderConfig = _initConfig.dualScreenVideoStreamConfig.highVideoEncoderConfig;
|
|
214
|
+
_this._deviceManager.localTrackObservable.addObserver(_this._localTrackObserver);
|
|
206
215
|
return _this;
|
|
207
216
|
}
|
|
208
217
|
(0, _inherits2["default"])(AgoraRtcChannelPublisherImpl, _AgoraRtcChannelPubli);
|
|
209
218
|
return (0, _createClass2["default"])(AgoraRtcChannelPublisherImpl, [{
|
|
219
|
+
key: "onLocalVideoTrackCreated",
|
|
220
|
+
value: function onLocalVideoTrackCreated(sourceId, sourceType, localTrack) {
|
|
221
|
+
if (sourceType === _type4.AgoraRtcVideoSourceType.CAMERA) {
|
|
222
|
+
this._mainPublishManager.onLocalVideoTrackCreated(sourceId, localTrack);
|
|
223
|
+
} else if (sourceType === _type4.AgoraRtcVideoSourceType.SCREEN) {
|
|
224
|
+
this._publishManagerBinderMap.forEach(function (binder) {
|
|
225
|
+
binder.publishManager.onLocalVideoTrackCreated(sourceId, localTrack);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "onLocalVideoTrackBeforeDestroy",
|
|
231
|
+
value: function onLocalVideoTrackBeforeDestroy(sourceId, sourceType, localTrack) {
|
|
232
|
+
if (sourceType === _type4.AgoraRtcVideoSourceType.CAMERA) {
|
|
233
|
+
this._mainPublishManager.onLocalVideoTrackBeforeDestroy(sourceId, localTrack);
|
|
234
|
+
} else if (sourceType === _type4.AgoraRtcVideoSourceType.SCREEN) {
|
|
235
|
+
this._publishManagerBinderMap.forEach(function (binder) {
|
|
236
|
+
binder.publishManager.onLocalVideoTrackBeforeDestroy(sourceId, localTrack);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}, {
|
|
241
|
+
key: "onLocalAudioTrackCreated",
|
|
242
|
+
value: function onLocalAudioTrackCreated(sourceId, sourceType, localTrack) {
|
|
243
|
+
if (sourceType === _type4.AgoraRtcAudioSourceType.MICROPHONE) {
|
|
244
|
+
this._mainPublishManager.onLocalAudioTrackCreated(sourceId, localTrack);
|
|
245
|
+
} else if (sourceType === _type4.AgoraRtcAudioSourceType.LOOPBACK) {
|
|
246
|
+
this._publishManagerBinderMap.forEach(function (binder) {
|
|
247
|
+
binder.publishManager.onLocalAudioTrackCreated(sourceId, localTrack);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
key: "onLocalAudioTrackBeforeDestroy",
|
|
253
|
+
value: function onLocalAudioTrackBeforeDestroy(sourceId, sourceType, localTrack) {
|
|
254
|
+
if (sourceType === _type4.AgoraRtcAudioSourceType.MICROPHONE) {
|
|
255
|
+
this._mainPublishManager.onLocalAudioTrackBeforeDestroy(sourceId, localTrack);
|
|
256
|
+
} else if (sourceType === _type4.AgoraRtcAudioSourceType.LOOPBACK) {
|
|
257
|
+
this._publishManagerBinderMap.forEach(function (binder) {
|
|
258
|
+
binder.publishManager.onLocalAudioTrackBeforeDestroy(sourceId, localTrack);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
key: "onVideoDeviceStateFlagUpdated",
|
|
264
|
+
value: function onVideoDeviceStateFlagUpdated(deviceId, flag) {
|
|
265
|
+
this._mainPublishManager.onVideoDeviceStateFlagUpdated(deviceId, flag);
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
key: "onAudioDeviceStateFlagUpdated",
|
|
269
|
+
value: function onAudioDeviceStateFlagUpdated(deviceId, flag) {
|
|
270
|
+
this._mainPublishManager.onAudioDeviceStateFlagUpdated(deviceId, flag);
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
210
273
|
key: "release",
|
|
211
274
|
value: function release() {
|
|
275
|
+
this._deviceManager.localTrackObservable.removeObserver(this._localTrackObserver);
|
|
212
276
|
this.sourceManager.removeObserver(this._sourceManagerObserver);
|
|
213
277
|
this.publishPool.removeObserver(this._publishPoolObserver);
|
|
214
278
|
}
|
|
@@ -424,7 +488,7 @@ var AgoraRtcPublishManagerBinder = /*#__PURE__*/function () {
|
|
|
424
488
|
this._rtcClient.disableDualStream();
|
|
425
489
|
}
|
|
426
490
|
}
|
|
427
|
-
this._publishManager = new _publish.AgoraRtcPublishManager(mode, this._rtcClient, this._deviceManager.
|
|
491
|
+
this._publishManager = new _publish.AgoraRtcPublishManager(mode, this._rtcClient, this._deviceManager.getVideoDeviceStateMap(), this._deviceManager.getAudioDeviceStateMap(), this._deviceManager.getScreenVideoTracksMap(), this._deviceManager.getScreenAudioTracksMap());
|
|
428
492
|
this._rtcClient.join(this._initConfig.appId, connection.channelId, token, +connection.localUid).then(function () {
|
|
429
493
|
_this2._trackStatsTask = _imports.AgoraScheduler.shared.addIntervalTask(_this2._handleTrackStatsTask, _imports.AgoraScheduler.Duration.second(2));
|
|
430
494
|
_this2._connected = true;
|
|
@@ -437,6 +501,11 @@ var AgoraRtcPublishManagerBinder = /*#__PURE__*/function () {
|
|
|
437
501
|
});
|
|
438
502
|
}
|
|
439
503
|
return (0, _createClass2["default"])(AgoraRtcPublishManagerBinder, [{
|
|
504
|
+
key: "publishManager",
|
|
505
|
+
get: function get() {
|
|
506
|
+
return this._publishManager;
|
|
507
|
+
}
|
|
508
|
+
}, {
|
|
440
509
|
key: "publishVideo",
|
|
441
510
|
value: function publishVideo(streamId, sourceId) {
|
|
442
511
|
this._hasPublishedVideo = true;
|
|
@@ -13,7 +13,17 @@ export interface AgoraRtcLocalTrackEventsObserver {
|
|
|
13
13
|
onLocalAudioTrackCreated?(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
|
|
14
14
|
onLocalAudioTrackBeforeDestroy?(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
|
|
15
15
|
onLocalAudioTrackFailedToCreate?(sourceId: string, sourceType: AgoraRtcAudioSourceType, error?: Error): void;
|
|
16
|
+
/**
|
|
17
|
+
* 当摄像头设备调用start或stop时触发
|
|
18
|
+
* @param deviceId
|
|
19
|
+
* @param stateFlag
|
|
20
|
+
*/
|
|
16
21
|
onVideoDeviceStateFlagUpdated?(deviceId: string, stateFlag: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* 当麦克风设备调用start或stop时触发
|
|
24
|
+
* @param deviceId
|
|
25
|
+
* @param stateFlag
|
|
26
|
+
*/
|
|
17
27
|
onAudioDeviceStateFlagUpdated?(deviceId: string, stateFlag: number): void;
|
|
18
28
|
}
|
|
19
29
|
export type AgoraWebRtcClientInitConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-rte-sdk",
|
|
3
|
-
"version": "3.7.8-rc.
|
|
3
|
+
"version": "3.7.8-rc.3",
|
|
4
4
|
"description": "SDK for building interactive scenarios",
|
|
5
5
|
"author": "agora.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/sinon": "^17.0.2",
|
|
29
29
|
"@types/ua-parser-js": "^0.7.35",
|
|
30
30
|
"agora-token": "^2.0.3",
|
|
31
|
-
"agora-toolchain": "
|
|
31
|
+
"agora-toolchain": "3.7.8-rc.3",
|
|
32
32
|
"core-js": "^3.33.3",
|
|
33
33
|
"electron": "22.3.27",
|
|
34
34
|
"husky": "^9.0.11",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"agora-extension-ai-denoiser": "^1.0.0",
|
|
44
44
|
"agora-extension-beauty-effect": "^1.0.1-beta",
|
|
45
45
|
"agora-extension-virtual-background": "^2.1.0",
|
|
46
|
-
"agora-foundation": "
|
|
46
|
+
"agora-foundation": "3.7.8-rc.3",
|
|
47
47
|
"agora-rtc-sdk-ng": "4.23.3",
|
|
48
48
|
"agora-rtm": "2.2.2-3",
|
|
49
49
|
"await-to-js": "^3.0.0",
|