@rongcloud/plugin-call 5.0.1-alpha.11 → 5.0.1-alpha.15
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/index.d.ts +45 -11
- package/dist/index.esm.js +161 -97
- package/dist/index.js +166 -114
- package/dist/index.umd.js +169 -117
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCCall - v5.0.1-alpha.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCCall - v5.0.1-alpha.15
|
|
3
|
+
* CommitId - 822cbe0e445807b91c775e9bc034fba931189ece
|
|
4
|
+
* Mon Oct 18 2021 08:45:49 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -39,6 +39,21 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* 产生session的场景
|
|
44
|
+
*/
|
|
45
|
+
var ProduceTypes;
|
|
46
|
+
(function (ProduceTypes) {
|
|
47
|
+
/**
|
|
48
|
+
* 主叫
|
|
49
|
+
*/
|
|
50
|
+
ProduceTypes[ProduceTypes["CALLER"] = 1] = "CALLER";
|
|
51
|
+
/**
|
|
52
|
+
* 被叫
|
|
53
|
+
*/
|
|
54
|
+
ProduceTypes[ProduceTypes["CALLEE"] = 2] = "CALLEE";
|
|
55
|
+
})(ProduceTypes || (ProduceTypes = {}));
|
|
56
|
+
|
|
42
57
|
class EventEmitter {
|
|
43
58
|
constructor() {
|
|
44
59
|
this.list = {};
|
|
@@ -236,6 +251,44 @@ const validateUserIds = (userIds) => {
|
|
|
236
251
|
}
|
|
237
252
|
return { result: true };
|
|
238
253
|
};
|
|
254
|
+
function isRCFrameRate(val) {
|
|
255
|
+
const arrs = ['FPS_10', 'FPS_15', 'FPS_24', 'FPS_30'];
|
|
256
|
+
return arrs.includes(val);
|
|
257
|
+
}
|
|
258
|
+
function isRCResolution(val) {
|
|
259
|
+
const arrs = ['W176_H132', 'W176_H144', 'W256_H144', 'W320_H180', 'W240_H240', 'W320_H240', 'W480_H360', 'W640_H360', 'W480_H480', 'W640_H480', 'W720_H480', 'W1280_H720', 'W1920_H1080'];
|
|
260
|
+
return arrs.includes(val);
|
|
261
|
+
}
|
|
262
|
+
const validateMediaStreamConstraints = (constraints) => {
|
|
263
|
+
if (constraints && constraints.audio && typeof constraints.audio.micphoneId !== 'undefined' && typeof constraints.audio.micphoneId !== 'string') {
|
|
264
|
+
return { result: false, msg: '\'constraints.audio.micphoneId\' must be of type \'string\'' };
|
|
265
|
+
}
|
|
266
|
+
if (constraints && constraints.audio && typeof constraints.audio.sampleRate !== 'undefined' && typeof constraints.audio.sampleRate !== 'number') {
|
|
267
|
+
return { result: false, msg: '\'constraints.audio.sampleRate\' must be of type \'number\'' };
|
|
268
|
+
}
|
|
269
|
+
if (constraints && constraints.video && typeof constraints.video.cameraId !== 'undefined' && typeof constraints.video.cameraId !== 'string') {
|
|
270
|
+
return { result: false, msg: '\'constraints.video.cameraId\' must be of type \'string\'' };
|
|
271
|
+
}
|
|
272
|
+
// if (constraints && constraints.video && typeof constraints.video.faceMode !== 'undefined' && constraints.video.cameraId !== 'user' && constraints.video.faceMode !== 'environment') {
|
|
273
|
+
// return { result: false, msg: '\'constraints.video.cameraId\' must be \'user\' or \'environment\'' }
|
|
274
|
+
// }
|
|
275
|
+
if (constraints && constraints.video && typeof constraints.video.frameRate !== 'undefined' && typeof constraints.video.frameRate !== 'string') {
|
|
276
|
+
return { result: false, msg: '\'constraints.video.frameRate\' must be of type \'string\'' };
|
|
277
|
+
}
|
|
278
|
+
if (constraints && constraints.video && typeof constraints.video.frameRate !== 'undefined' && !isRCFrameRate(constraints.video.frameRate)) {
|
|
279
|
+
return { result: false, msg: '\'frameRate\' value is out of range' };
|
|
280
|
+
}
|
|
281
|
+
if (constraints && constraints.video && typeof constraints.video.resolution !== 'undefined' && typeof constraints.video.resolution !== 'string') {
|
|
282
|
+
return { result: false, msg: '\'constraints.video.frameRate\' must be of type \'string\'' };
|
|
283
|
+
}
|
|
284
|
+
if (constraints && constraints.video && typeof constraints.video.resolution !== 'undefined' && !isRCResolution(constraints.video.resolution)) {
|
|
285
|
+
return { result: false, msg: '\'resolution\' value is out of range' };
|
|
286
|
+
}
|
|
287
|
+
if (constraints && constraints.video && (!constraints.video.frameRate || !constraints.video.resolution)) {
|
|
288
|
+
return { result: false, msg: '\'resolution\' and \'resolution\' is required' };
|
|
289
|
+
}
|
|
290
|
+
return { result: true };
|
|
291
|
+
};
|
|
239
292
|
|
|
240
293
|
class RCCallSession {
|
|
241
294
|
constructor(
|
|
@@ -255,7 +308,7 @@ class RCCallSession {
|
|
|
255
308
|
this._rtcClient = _rtcClient;
|
|
256
309
|
this._options = _options;
|
|
257
310
|
/**
|
|
258
|
-
* 用户传进来的 对session的监听
|
|
311
|
+
* 用户传进来的 对session的监听 (要在RCCallClient的_onInvite里判断,要求执行完onSession必须注册session的监听,所以这里是public)
|
|
259
312
|
*/
|
|
260
313
|
this._listener = null;
|
|
261
314
|
/**
|
|
@@ -502,10 +555,6 @@ class RCCallSession {
|
|
|
502
555
|
*/
|
|
503
556
|
_publish() {
|
|
504
557
|
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
-
// 主叫方发起call时,提前获得了本地资源的情况
|
|
506
|
-
if (!this._options.localTracks) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
558
|
const tracks = this._options.localTracks;
|
|
510
559
|
const { code } = yield this._publishRetry(tracks, this._options.isAllowPublishRetry, this._RETRYCOUNT);
|
|
511
560
|
// 若资源发布失败
|
|
@@ -514,8 +563,11 @@ class RCCallSession {
|
|
|
514
563
|
logger.info(`[RCCallSession _publist] Resource publishing failed: roomId -> ${this._stateMachine.getCallId()} RCRTCCode -> ${code}`);
|
|
515
564
|
return;
|
|
516
565
|
}
|
|
517
|
-
//
|
|
518
|
-
this.
|
|
566
|
+
// 如果是主动发起的呼叫,已提前抛出了资源, 被动呼叫,这里才需要抛出
|
|
567
|
+
if (this._options.produceType === ProduceTypes.CALLEE) {
|
|
568
|
+
// 向外抛出本地流, 通知业务层trackReady
|
|
569
|
+
this._notifyTrackReady(tracks);
|
|
570
|
+
}
|
|
519
571
|
});
|
|
520
572
|
}
|
|
521
573
|
/**
|
|
@@ -596,7 +648,7 @@ class RCCallSession {
|
|
|
596
648
|
return __awaiter(this, void 0, void 0, function* () {
|
|
597
649
|
// 检测是否能够获得本地流
|
|
598
650
|
if (mediaType === pluginCallEngine.RCCallMediaType.AUDIO) {
|
|
599
|
-
const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', constraints && Object.assign({}, constraints.audio));
|
|
651
|
+
const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', constraints && constraints.audio && Object.assign({}, constraints.audio));
|
|
600
652
|
if (code !== pluginRtc.RCRTCCode.SUCCESS) {
|
|
601
653
|
logger.error(`[RCCallSession _getLocalTrackCore] get Audio local tracks failed RCT code -> ${code}`);
|
|
602
654
|
return { code: pluginCallEngine.RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
|
|
@@ -644,87 +696,44 @@ class RCCallSession {
|
|
|
644
696
|
});
|
|
645
697
|
}
|
|
646
698
|
/**
|
|
647
|
-
*
|
|
699
|
+
* 通话中更换音频设备
|
|
648
700
|
*/
|
|
649
|
-
|
|
701
|
+
changeAudioDevice(audioConstraints) {
|
|
650
702
|
return __awaiter(this, void 0, void 0, function* () {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
// 新产生的track
|
|
660
|
-
let recentTracks = [];
|
|
661
|
-
const mediaType = this._stateMachine.getMediaType();
|
|
662
|
-
// 如果当前是音视频通话 并且有视频参数和音频参数
|
|
663
|
-
if (mediaType === pluginCallEngine.RCCallMediaType.AUDIO_VIDEO && constraints.video && constraints.audio) {
|
|
664
|
-
const { code, tracks } = yield this._rtcClient.createMicrophoneAndCameraTracks('RongCloudRTC', Object.assign({}, constraints));
|
|
665
|
-
if (code !== pluginRtc.RCRTCCode.SUCCESS) {
|
|
666
|
-
logger.error(`[RCCallSession changeDevice] get local Audo and Video tracks failed RCT code -> ${code}`);
|
|
667
|
-
return { code: pluginCallEngine.RCCallErrorCode.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR };
|
|
668
|
-
}
|
|
669
|
-
// 把之前的track销毁
|
|
670
|
-
this._options.localTracks && this._destroyTracks(this._options.localTracks);
|
|
671
|
-
recentTracks = tracks;
|
|
672
|
-
this._options.localTracks = recentTracks;
|
|
673
|
-
// 如果当前是音视频通话 并且有视频参数
|
|
703
|
+
// 新设备的track
|
|
704
|
+
const recentTracks = [];
|
|
705
|
+
// 整理后的本地track
|
|
706
|
+
const localTracks = [];
|
|
707
|
+
const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', audioConstraints);
|
|
708
|
+
if (code !== pluginRtc.RCRTCCode.SUCCESS) {
|
|
709
|
+
logger.error(`[RCCallSession changeDevice] get local Audio tracks failed RCTLib code -> ${code}`);
|
|
710
|
+
return { code: pluginCallEngine.RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
|
|
674
711
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
return { code: pluginCallEngine.RCCallErrorCode.GET_LOCAL_VIDEO_TRACK_ERROR };
|
|
712
|
+
this._options.localTracks && this._options.localTracks.forEach((track) => {
|
|
713
|
+
if (track.isAudioTrack()) {
|
|
714
|
+
// 之前的音频都销毁
|
|
715
|
+
track.destroy();
|
|
680
716
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
// 之前的视频都销毁
|
|
685
|
-
track.destroy();
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
// 只留下之前的音频
|
|
689
|
-
localTracks.push(track);
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
recentTracks = [track];
|
|
693
|
-
// 加上本地新产生的视频
|
|
694
|
-
localTracks.push(track);
|
|
695
|
-
this._options.localTracks = localTracks;
|
|
696
|
-
// 如果当前是音视频通话 并且有音频参数 或 音频通话有音频参数
|
|
697
|
-
}
|
|
698
|
-
else if (constraints.audio) {
|
|
699
|
-
const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', Object.assign({}, constraints.audio));
|
|
700
|
-
if (code !== pluginRtc.RCRTCCode.SUCCESS) {
|
|
701
|
-
logger.error(`[RCCallSession changeDevice] get local Audio tracks failed RCT code -> ${code}`);
|
|
702
|
-
return { code: pluginCallEngine.RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
|
|
717
|
+
else {
|
|
718
|
+
// 只把之前的视频留下
|
|
719
|
+
localTracks.push(track);
|
|
703
720
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
track.destroy();
|
|
710
|
-
}
|
|
711
|
-
else {
|
|
712
|
-
// 只把之前的视频留下
|
|
713
|
-
localTracks.push(track);
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
recentTracks = [track];
|
|
717
|
-
// 加上本地新产生的音频
|
|
718
|
-
localTracks.push(track);
|
|
719
|
-
this._options.localTracks = localTracks;
|
|
720
|
-
}
|
|
721
|
+
});
|
|
722
|
+
recentTracks.push(track);
|
|
723
|
+
// 加上本地新产生的音频
|
|
724
|
+
localTracks.push(track);
|
|
725
|
+
this._options.localTracks = localTracks;
|
|
721
726
|
// 通知业务层trackReady
|
|
722
727
|
this._notifyTrackReady(recentTracks);
|
|
723
728
|
// 如果当前已加入房间,发布新流
|
|
724
729
|
if (this._room) {
|
|
725
730
|
// 发布新流
|
|
726
|
-
this.
|
|
731
|
+
const { code } = yield this._room.publish(recentTracks);
|
|
732
|
+
if (code !== pluginRtc.RCRTCCode.SUCCESS) {
|
|
733
|
+
return { code: pluginCallEngine.RCCallErrorCode.AUDIO_PUBLISH_ERROR };
|
|
734
|
+
}
|
|
727
735
|
}
|
|
736
|
+
return { code: pluginCallEngine.RCCallErrorCode.SUCCESS };
|
|
728
737
|
});
|
|
729
738
|
}
|
|
730
739
|
/**
|
|
@@ -733,6 +742,11 @@ class RCCallSession {
|
|
|
733
742
|
*/
|
|
734
743
|
invite(userIds) {
|
|
735
744
|
return __awaiter(this, void 0, void 0, function* () {
|
|
745
|
+
const conversationType = this._stateMachine.getConversationType();
|
|
746
|
+
// 如果当前不是群组通话,直接返回错误码
|
|
747
|
+
if (conversationType !== engine.ConversationType.GROUP) {
|
|
748
|
+
return { code: pluginCallEngine.RCCallErrorCode.CONVERSATION_NOT_GROUP_ERROR };
|
|
749
|
+
}
|
|
736
750
|
const conclusion = validateUserIds(userIds);
|
|
737
751
|
if (!conclusion.result) {
|
|
738
752
|
throw new Error(`[RCCallSession invite] ${conclusion.msg}`);
|
|
@@ -746,10 +760,11 @@ class RCCallSession {
|
|
|
746
760
|
*/
|
|
747
761
|
accept(constraints) {
|
|
748
762
|
return __awaiter(this, void 0, void 0, function* () {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
763
|
+
const conclusion = validateMediaStreamConstraints(constraints);
|
|
764
|
+
if (!conclusion.result) {
|
|
765
|
+
throw new Error(`[RCCallSession accept] ${conclusion.msg}`);
|
|
766
|
+
}
|
|
767
|
+
// 接听之前,先挂断当前之外的session,现阶段不允许用户先择接听session,事先会在状态机内部挂断,这里抛出去,会清理其它的seesion
|
|
753
768
|
eventEmitter.emit('hungupOtherSession', { session: this });
|
|
754
769
|
const mediaType = this._stateMachine.getMediaType();
|
|
755
770
|
const { code: _code, tracks } = yield this._getLocalTrack(mediaType, constraints);
|
|
@@ -802,6 +817,21 @@ class RCCallSession {
|
|
|
802
817
|
}
|
|
803
818
|
return localVideoTracks;
|
|
804
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* 获得本地音频
|
|
822
|
+
*/
|
|
823
|
+
_getLocalAudioTracks() {
|
|
824
|
+
let localAudiotracks = [];
|
|
825
|
+
if (!this._room) {
|
|
826
|
+
return localAudiotracks;
|
|
827
|
+
}
|
|
828
|
+
if (this._options.localTracks) {
|
|
829
|
+
localAudiotracks = this._options.localTracks.filter((track) => {
|
|
830
|
+
return track.isAudioTrack();
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
return localAudiotracks;
|
|
834
|
+
}
|
|
805
835
|
/**
|
|
806
836
|
* 把通话的MediaType升级到音视频
|
|
807
837
|
*/
|
|
@@ -945,6 +975,30 @@ class RCCallSession {
|
|
|
945
975
|
return { code: pluginCallEngine.RCCallErrorCode.SUCCESS };
|
|
946
976
|
});
|
|
947
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* 禁用音频track
|
|
980
|
+
*/
|
|
981
|
+
disableAudioTrack() {
|
|
982
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
983
|
+
const tracks = this._getLocalAudioTracks();
|
|
984
|
+
// 禁用音频
|
|
985
|
+
tracks.forEach((track) => {
|
|
986
|
+
track.mute();
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* 启用音频track
|
|
992
|
+
*/
|
|
993
|
+
enableAudioTrack() {
|
|
994
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
995
|
+
const tracks = this._getLocalAudioTracks();
|
|
996
|
+
// 启用音频
|
|
997
|
+
tracks.forEach((track) => {
|
|
998
|
+
track.unmute();
|
|
999
|
+
});
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
948
1002
|
/**
|
|
949
1003
|
* 销毁本地流
|
|
950
1004
|
*/
|
|
@@ -1160,7 +1214,7 @@ class RCCallSession {
|
|
|
1160
1214
|
return this._stateMachine.getCallId();
|
|
1161
1215
|
}
|
|
1162
1216
|
/**
|
|
1163
|
-
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId
|
|
1217
|
+
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新,(用户录制资源用的)
|
|
1164
1218
|
*/
|
|
1165
1219
|
getRTCSessionId() {
|
|
1166
1220
|
return this._room.getSessionId();
|
|
@@ -1257,7 +1311,7 @@ class RCCallClient {
|
|
|
1257
1311
|
lang: pluginCallEngine.RCCallLanguage.ZH
|
|
1258
1312
|
}, _options);
|
|
1259
1313
|
// 初始化callEngine, 并监听onInvite
|
|
1260
|
-
this._callEngine = new pluginCallEngine.RCCallEngine(this._context, logger, {
|
|
1314
|
+
this._callEngine = new pluginCallEngine.RCCallEngine(this._context, _runtime, logger, {
|
|
1261
1315
|
/**
|
|
1262
1316
|
* 监听收到invite
|
|
1263
1317
|
*/
|
|
@@ -1324,7 +1378,9 @@ class RCCallClient {
|
|
|
1324
1378
|
*/
|
|
1325
1379
|
joinType: this._options.joinType,
|
|
1326
1380
|
// 允许降级获得流,获得音视频不成功 ,降级获得音频, 默认不允许
|
|
1327
|
-
isAllowDemotionGetStream: this._options.isAllowDemotionGetStream
|
|
1381
|
+
isAllowDemotionGetStream: this._options.isAllowDemotionGetStream,
|
|
1382
|
+
// 标明是被叫产生的session
|
|
1383
|
+
produceType: ProduceTypes.CALLEE
|
|
1328
1384
|
});
|
|
1329
1385
|
logger.info('[RCCallClient _onInvite] Received invite message, successfully created session');
|
|
1330
1386
|
/**
|
|
@@ -1351,6 +1407,10 @@ class RCCallClient {
|
|
|
1351
1407
|
throw new Error('[RCCallSession _options.onSession] session Must Have Listener');
|
|
1352
1408
|
}
|
|
1353
1409
|
}
|
|
1410
|
+
/**
|
|
1411
|
+
* 监听离线消息报告
|
|
1412
|
+
* @param record
|
|
1413
|
+
*/
|
|
1354
1414
|
_onOfflineRecord(record) {
|
|
1355
1415
|
try {
|
|
1356
1416
|
// 执行用户API的监听
|
|
@@ -1419,7 +1479,9 @@ class RCCallClient {
|
|
|
1419
1479
|
*/
|
|
1420
1480
|
joinType: this._options.joinType,
|
|
1421
1481
|
// 允许降级获得流,获得音视频不成功 ,降级获得音频, 默认不允许
|
|
1422
|
-
isAllowDemotionGetStream: this._options.isAllowDemotionGetStream
|
|
1482
|
+
isAllowDemotionGetStream: this._options.isAllowDemotionGetStream,
|
|
1483
|
+
// 标明是主叫产生的session
|
|
1484
|
+
produceType: ProduceTypes.CALLER
|
|
1423
1485
|
});
|
|
1424
1486
|
// session上注册监听事件
|
|
1425
1487
|
session.registerSessionListener(listener);
|
|
@@ -1488,7 +1550,9 @@ class RCCallClient {
|
|
|
1488
1550
|
*/
|
|
1489
1551
|
joinType: this._options.joinType,
|
|
1490
1552
|
// 允许降级获得流,获得音视频不成功 ,降级获得音频, 默认不允许
|
|
1491
|
-
isAllowDemotionGetStream: this._options.isAllowDemotionGetStream
|
|
1553
|
+
isAllowDemotionGetStream: this._options.isAllowDemotionGetStream,
|
|
1554
|
+
// 标明是主叫产生的session
|
|
1555
|
+
produceType: ProduceTypes.CALLER
|
|
1492
1556
|
});
|
|
1493
1557
|
// session上注册监听事件
|
|
1494
1558
|
session.registerSessionListener(listener);
|
|
@@ -1511,11 +1575,11 @@ class RCCallClient {
|
|
|
1511
1575
|
/**
|
|
1512
1576
|
* 调RTC API 获得本地流
|
|
1513
1577
|
*/
|
|
1514
|
-
|
|
1578
|
+
_getLocalTrackCore(mediaType, constraints) {
|
|
1515
1579
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1516
1580
|
// 检测是否能够获得本地流
|
|
1517
1581
|
if (mediaType === pluginCallEngine.RCCallMediaType.AUDIO) {
|
|
1518
|
-
const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', constraints && Object.assign({}, constraints.audio));
|
|
1582
|
+
const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', constraints && constraints.audio && Object.assign({}, constraints.audio));
|
|
1519
1583
|
if (code !== pluginRtc.RCRTCCode.SUCCESS) {
|
|
1520
1584
|
logger.error(`[RCCallClient _getTrack] get Audio local tracks failed RCT code -> ${code}`);
|
|
1521
1585
|
return { code: pluginCallEngine.RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
|
|
@@ -1538,10 +1602,10 @@ class RCCallClient {
|
|
|
1538
1602
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1539
1603
|
// 如果是允许降级获得流,并且是获得音视频
|
|
1540
1604
|
if (this._options.isAllowDemotionGetStream && mediaType === pluginCallEngine.RCCallMediaType.AUDIO_VIDEO) {
|
|
1541
|
-
const { code, tracks } = yield this.
|
|
1605
|
+
const { code, tracks } = yield this._getLocalTrackCore(pluginCallEngine.RCCallMediaType.AUDIO_VIDEO, constraints);
|
|
1542
1606
|
// 如果音视频不能获得,就降组获得音频
|
|
1543
1607
|
if (code !== pluginCallEngine.RCCallErrorCode.SUCCESS) {
|
|
1544
|
-
const { code, tracks } = yield this.
|
|
1608
|
+
const { code, tracks } = yield this._getLocalTrackCore(pluginCallEngine.RCCallMediaType.AUDIO, constraints);
|
|
1545
1609
|
if (code !== pluginCallEngine.RCCallErrorCode.SUCCESS) {
|
|
1546
1610
|
return { code };
|
|
1547
1611
|
}
|
|
@@ -1550,7 +1614,7 @@ class RCCallClient {
|
|
|
1550
1614
|
return { code, tracks: tracks };
|
|
1551
1615
|
}
|
|
1552
1616
|
else {
|
|
1553
|
-
const { code: _code, tracks } = yield this.
|
|
1617
|
+
const { code: _code, tracks } = yield this._getLocalTrackCore(mediaType, constraints);
|
|
1554
1618
|
if (_code !== pluginCallEngine.RCCallErrorCode.SUCCESS) {
|
|
1555
1619
|
return { code: _code };
|
|
1556
1620
|
}
|
|
@@ -1597,46 +1661,34 @@ const installer = {
|
|
|
1597
1661
|
}
|
|
1598
1662
|
logger.setLogLevel(options.logLevel);
|
|
1599
1663
|
logger.setLogStdout(options.logStdout);
|
|
1600
|
-
logger.warn(`RCCall Version: ${"5.0.1-alpha.
|
|
1664
|
+
logger.warn(`RCCall Version: ${"5.0.1-alpha.15"}, Commit: ${"822cbe0e445807b91c775e9bc034fba931189ece"}`);
|
|
1601
1665
|
return new RCCallClient(context, runtime, options);
|
|
1602
1666
|
}
|
|
1603
1667
|
};
|
|
1604
1668
|
|
|
1605
1669
|
Object.defineProperty(exports, 'RCCallEndReason', {
|
|
1606
1670
|
enumerable: true,
|
|
1607
|
-
get: function () {
|
|
1608
|
-
return pluginCallEngine.RCCallEndReason;
|
|
1609
|
-
}
|
|
1671
|
+
get: function () { return pluginCallEngine.RCCallEndReason; }
|
|
1610
1672
|
});
|
|
1611
1673
|
Object.defineProperty(exports, 'RCCallErrorCode', {
|
|
1612
1674
|
enumerable: true,
|
|
1613
|
-
get: function () {
|
|
1614
|
-
return pluginCallEngine.RCCallErrorCode;
|
|
1615
|
-
}
|
|
1675
|
+
get: function () { return pluginCallEngine.RCCallErrorCode; }
|
|
1616
1676
|
});
|
|
1617
1677
|
Object.defineProperty(exports, 'RCCallLanguage', {
|
|
1618
1678
|
enumerable: true,
|
|
1619
|
-
get: function () {
|
|
1620
|
-
return pluginCallEngine.RCCallLanguage;
|
|
1621
|
-
}
|
|
1679
|
+
get: function () { return pluginCallEngine.RCCallLanguage; }
|
|
1622
1680
|
});
|
|
1623
1681
|
Object.defineProperty(exports, 'RCCallMediaType', {
|
|
1624
1682
|
enumerable: true,
|
|
1625
|
-
get: function () {
|
|
1626
|
-
return pluginCallEngine.RCCallMediaType;
|
|
1627
|
-
}
|
|
1683
|
+
get: function () { return pluginCallEngine.RCCallMediaType; }
|
|
1628
1684
|
});
|
|
1629
1685
|
Object.defineProperty(exports, 'RCCallSessionState', {
|
|
1630
1686
|
enumerable: true,
|
|
1631
|
-
get: function () {
|
|
1632
|
-
return pluginCallEngine.RCCallSessionState;
|
|
1633
|
-
}
|
|
1687
|
+
get: function () { return pluginCallEngine.RCCallSessionState; }
|
|
1634
1688
|
});
|
|
1635
1689
|
Object.defineProperty(exports, 'RCCallUserState', {
|
|
1636
1690
|
enumerable: true,
|
|
1637
|
-
get: function () {
|
|
1638
|
-
return pluginCallEngine.RCCallUserState;
|
|
1639
|
-
}
|
|
1691
|
+
get: function () { return pluginCallEngine.RCCallUserState; }
|
|
1640
1692
|
});
|
|
1641
1693
|
exports.RCCallClient = RCCallClient;
|
|
1642
1694
|
exports.RCCallSession = RCCallSession;
|