@rongcloud/plugin-rtc 5.4.7 → 5.5.2-alpha.2

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.
Files changed (103) hide show
  1. package/dist/index.d.ts +405 -34
  2. package/dist/index.esm.js +21612 -15
  3. package/dist/index.js +21641 -15
  4. package/dist/index.umd.js +21645 -15
  5. package/package.json +2 -5
  6. package/dist/async-task-queue.d.ts +0 -9
  7. package/dist/core/Invoker.d.ts +0 -54
  8. package/dist/core/PolarisReporter.d.ts +0 -35
  9. package/dist/core/RCAudienceClient.d.ts +0 -89
  10. package/dist/core/RCMediaStreamCapture.d.ts +0 -124
  11. package/dist/core/RCRTCClient.d.ts +0 -126
  12. package/dist/core/Store.d.ts +0 -84
  13. package/dist/core/command/AsyncCommand.d.ts +0 -55
  14. package/dist/core/command/AsyncSubscribeCommand.d.ts +0 -28
  15. package/dist/core/command/AsyncUnsubscribeCommand.d.ts +0 -28
  16. package/dist/core/command/AsyncUpdateSubscribeListCommand.d.ts +0 -25
  17. package/dist/core/command/BaseCommand.d.ts +0 -31
  18. package/dist/core/command/EnabelInnerCDNCommand.d.ts +0 -16
  19. package/dist/core/command/ExchangeCommand.d.ts +0 -18
  20. package/dist/core/command/ExchangeWithPushOtherRoomCommand.d.ts +0 -22
  21. package/dist/core/command/JoinRoomCommand.d.ts +0 -28
  22. package/dist/core/command/LeaveOtherRoomCommand.d.ts +0 -32
  23. package/dist/core/command/LocalTrackMuteCommand.d.ts +0 -18
  24. package/dist/core/command/MCUConfigFlushCommand.d.ts +0 -18
  25. package/dist/core/command/OnRemoteUserUnpubCommand.d.ts +0 -13
  26. package/dist/core/command/OnSignalReconnectedCommand.d.ts +0 -38
  27. package/dist/core/command/ParseRemoteResCommand.d.ts +0 -38
  28. package/dist/core/command/ParseUserStateCommand.d.ts +0 -57
  29. package/dist/core/command/PublishCommand.d.ts +0 -36
  30. package/dist/core/command/RTCIdentityChangeCommand.d.ts +0 -17
  31. package/dist/core/command/RetryExchangeCommand.d.ts +0 -18
  32. package/dist/core/command/SubscribeCommand.d.ts +0 -21
  33. package/dist/core/command/UnpublishCommand.d.ts +0 -22
  34. package/dist/core/command/UnpublishPrevCommand.d.ts +0 -11
  35. package/dist/core/command/UnsubscribeCommand.d.ts +0 -20
  36. package/dist/core/command/UpdateSubscribeListCommand.d.ts +0 -28
  37. package/dist/core/command/helper.d.ts +0 -20
  38. package/dist/core/constants.d.ts +0 -2
  39. package/dist/core/enums/BackgroundPictureFillMode.d.ts +0 -14
  40. package/dist/core/enums/MixLayoutMode.d.ts +0 -18
  41. package/dist/core/enums/MixVideoRenderMode.d.ts +0 -14
  42. package/dist/core/enums/RCBitrate.d.ts +0 -48
  43. package/dist/core/enums/RCCommandKind.d.ts +0 -12
  44. package/dist/core/enums/RCFrameRate.d.ts +0 -7
  45. package/dist/core/enums/RCInnerCDNBroadcast.d.ts +0 -5
  46. package/dist/core/enums/RCInnerCDNModel.d.ts +0 -5
  47. package/dist/core/enums/RCInnerCDNPullIsHttps.d.ts +0 -5
  48. package/dist/core/enums/RCInnerCDNPullKind.d.ts +0 -6
  49. package/dist/core/enums/RCInnerCDNPushMode.d.ts +0 -5
  50. package/dist/core/enums/RCKickType.d.ts +0 -11
  51. package/dist/core/enums/RCLinkedListPoint.d.ts +0 -6
  52. package/dist/core/enums/RCLivingType.d.ts +0 -14
  53. package/dist/core/enums/RCLoggerTag.d.ts +0 -641
  54. package/dist/core/enums/RCMediaType.d.ts +0 -18
  55. package/dist/core/enums/RCMixInputFilterMode.d.ts +0 -35
  56. package/dist/core/enums/RCRTCCode.d.ts +0 -90
  57. package/dist/core/enums/RCRTCLiveRole.d.ts +0 -14
  58. package/dist/core/enums/RCRTCPingResult.d.ts +0 -5
  59. package/dist/core/enums/RCRTCResolution.d.ts +0 -132
  60. package/dist/core/enums/RCResolution.d.ts +0 -21
  61. package/dist/core/enums/inner/PolarisRole.d.ts +0 -14
  62. package/dist/core/enums/inner/R2Action.d.ts +0 -14
  63. package/dist/core/enums/inner/R2Status.d.ts +0 -11
  64. package/dist/core/enums/inner/RCRTCMessageType.d.ts +0 -70
  65. package/dist/core/enums/inner/RCStreamType.d.ts +0 -14
  66. package/dist/core/enums/inner/TrackState.d.ts +0 -14
  67. package/dist/core/interfaces.d.ts +0 -931
  68. package/dist/core/room/Pinger.d.ts +0 -35
  69. package/dist/core/room/RCAbstractRoom.d.ts +0 -350
  70. package/dist/core/room/RCAudienceLivingRoom.d.ts +0 -329
  71. package/dist/core/room/RCAudioLevelReport.d.ts +0 -18
  72. package/dist/core/room/RCLivingPKHandler.d.ts +0 -164
  73. package/dist/core/room/RCLivingRoom.d.ts +0 -108
  74. package/dist/core/room/RCLocalMediaStream.d.ts +0 -8
  75. package/dist/core/room/RCMCUConfigBuilder.d.ts +0 -211
  76. package/dist/core/room/RCRTCRoom.d.ts +0 -15
  77. package/dist/core/service/RCMediaService.d.ts +0 -96
  78. package/dist/core/service/helper.d.ts +0 -8
  79. package/dist/core/service/index.d.ts +0 -6
  80. package/dist/core/service/interface.d.ts +0 -323
  81. package/dist/core/service/mcu-interface.d.ts +0 -293
  82. package/dist/core/tracks/RC3AnoiseTrack.d.ts +0 -27
  83. package/dist/core/tracks/RCLocalTrack.d.ts +0 -143
  84. package/dist/core/tracks/RCRemoteTrack.d.ts +0 -29
  85. package/dist/core/tracks/RCTrack.d.ts +0 -95
  86. package/dist/core/webrtc/RCRTCPeerCManager.d.ts +0 -161
  87. package/dist/core/webrtc/RCRTCPeerConnection.d.ts +0 -120
  88. package/dist/core/webrtc/helper.d.ts +0 -26
  89. package/dist/core/webrtc/sdp/ASdpBuilder.d.ts +0 -120
  90. package/dist/core/webrtc/sdp/ASdpStrategy.d.ts +0 -53
  91. package/dist/core/webrtc/sdp/PlanBSdpBuilder.d.ts +0 -20
  92. package/dist/core/webrtc/sdp/PlanBStrategy.d.ts +0 -26
  93. package/dist/core/webrtc/sdp/SDPUtils.d.ts +0 -60
  94. package/dist/core/webrtc/sdp/UnifiedPlanSdpBuilder.d.ts +0 -11
  95. package/dist/core/webrtc/sdp/UnifiedPlanStrategy.d.ts +0 -25
  96. package/dist/core/webrtc/stat-parser/AbstractStatParser.d.ts +0 -117
  97. package/dist/core/webrtc/stat-parser/ChromeStatParser.d.ts +0 -14
  98. package/dist/core/webrtc/stat-parser/FirefoxStatParser.d.ts +0 -14
  99. package/dist/core/webrtc/stat-parser/IStatParser.d.ts +0 -24
  100. package/dist/core/webrtc/stat-parser/SafariStatParser.d.ts +0 -14
  101. package/dist/device.d.ts +0 -6
  102. package/dist/helper.d.ts +0 -193
  103. package/dist/logger.d.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rongcloud/plugin-rtc",
3
- "version": "5.4.7",
3
+ "version": "5.5.2-alpha.2",
4
4
  "description": "@rongcloud/plugin-rtc",
5
5
  "main": "./dist/index.js",
6
6
  "__attrs__": {
@@ -30,8 +30,5 @@
30
30
  "engines": {
31
31
  "node": ">=10.0.0"
32
32
  },
33
- "peerDependencies": {
34
- "@rongcloud/engine": "5.3.4 - 5.4.5"
35
- },
36
- "__commit__": "25ac42535d0f142de4179ee5b74a714f361e1712"
33
+ "__commit__": "6de076a491750ccb3861c8008ba1147a4812d1a8"
37
34
  }
@@ -1,9 +0,0 @@
1
- export declare type AsyncTask<T = void> = () => Promise<T>;
2
- /**
3
- * 将异步任务推送到异步队列,队列内任务先进先出,依次执行,执行完成后通过
4
- * Promise.resolve 返回执行结果
5
- * @param task 传参不能是 `async () => {}` 所定义的异步函数,
6
- * 只能使用明确的 `() => Promise<T> | T` 形式,避免转义时微任务被提前执行
7
- */
8
- export declare const push: <T>(task: AsyncTask<T>, name?: string) => Promise<T>;
9
- //# sourceMappingURL=async-task-queue.d.ts.map
@@ -1,54 +0,0 @@
1
- import { RTCMode, RTCPluginContext } from '@rongcloud/engine';
2
- import { BaseCommand } from './command/BaseCommand';
3
- import { RCRTCCode } from './enums/RCRTCCode';
4
- import PolarisReporter from './PolarisReporter';
5
- import { RCMediaService } from './service';
6
- import { ReadableStore, Store } from './Store';
7
- import RCRTCPeerCManager from './webrtc/RCRTCPeerCManager';
8
- export declare class BaseInvoker<STORE> {
9
- /**
10
- * 内存数据管理实例
11
- */
12
- protected readonly _store: STORE;
13
- /**
14
- * 命令终止时返回的错误码定义
15
- */
16
- private abortCode;
17
- constructor(
18
- /**
19
- * 内存数据管理实例
20
- */
21
- _store: STORE,
22
- /**
23
- * 命令终止时返回的错误码定义
24
- */
25
- abortCode: RCRTCCode);
26
- private _queue;
27
- private _busy;
28
- private _next;
29
- private _execute;
30
- push<R>(command: BaseCommand<R, STORE>): Promise<R>;
31
- private _isDestroyed;
32
- /**
33
- * 查找出 RCCommandKind.AsyncCommand 类型的 Command,并将其从队列中删除
34
- * 并使用最新的一次 Command 接管它的 resolve & reject
35
- * @param resolve
36
- * @param reject
37
- * @returns 具有两个属性的对象,resolve 和 reject。
38
- */
39
- private commandOffset;
40
- isDestroyed(): boolean;
41
- destroy(): void;
42
- }
43
- /**
44
- * 房间任务队列管理
45
- */
46
- export declare class Invoker extends BaseInvoker<Store> {
47
- constructor(context: RTCPluginContext, service: RCMediaService, peerMrg: RCRTCPeerCManager, roomId: string, crtUserId: string, mode: RTCMode, reporter: PolarisReporter, isUpgrade?: boolean, isMainRoom?: boolean);
48
- /**
49
- * 获取 store 存储实例,返回值类型 `ReadableStore`,避免非 command 定义中修改内存
50
- */
51
- get store(): ReadableStore;
52
- destroy(): void;
53
- }
54
- //# sourceMappingURL=Invoker.d.ts.map
@@ -1,35 +0,0 @@
1
- import { RTCPluginContext, IRuntime } from '@rongcloud/engine';
2
- import { IInnerRCRTCStateReport } from './interfaces';
3
- import RCAbstractRoom from './room/RCAbstractRoom';
4
- import RCAudienceLivingRoom from './room/RCAudienceLivingRoom';
5
- import { PolarisRole } from './enums/inner/PolarisRole';
6
- export default class PolarisReporter {
7
- private readonly _context;
8
- private readonly _runtime;
9
- private readonly _roomId;
10
- private readonly _crtRTCRoom;
11
- private readonly _userRole;
12
- constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, _crtRTCRoom: RCAbstractRoom | RCAudienceLivingRoom, _userRole?: PolarisRole);
13
- private _send;
14
- private _getClientID;
15
- /**
16
- * 小流需去掉 _tiny,小流 resourceId 为 userId_tag_mediaType_tiny
17
- */
18
- private _getRealResourceId;
19
- /**
20
- * 生成北极星上报的 trackId
21
- * @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
22
- */
23
- private _getPolarisTrackId;
24
- sendR3R4Data(data: IInnerRCRTCStateReport): Promise<boolean>;
25
- /**
26
- * 加入房间
27
- */
28
- sendR1(): void;
29
- /**
30
- * RTC 和 LIVE 发布、取消发布
31
- * RTC 订阅、取消订阅
32
- */
33
- sendR2(action: string, status: string, trackIds: string[]): void;
34
- }
35
- //# sourceMappingURL=PolarisReporter.d.ts.map
@@ -1,89 +0,0 @@
1
- import { IRuntime, RTCPluginContext } from '@rongcloud/engine';
2
- import { IRCRTCReportListener, IRCRTCTrackEventListener, IRCRTCInitOptions } from './interfaces';
3
- import { RCRemoteTrack } from './tracks/RCRemoteTrack';
4
- import { RCLivingType } from './enums/RCLivingType';
5
- import { RCRTCCode } from './enums/RCRTCCode';
6
- import { RCMediaType } from './enums/RCMediaType';
7
- /**
8
- * 直播观众客户端
9
- */
10
- export default class RCAudienceClient {
11
- private readonly _context;
12
- /**
13
- * 是否使用多 peerConnection
14
- */
15
- private readonly _useMutilPeerC?;
16
- private _pc;
17
- private _service;
18
- /**
19
- * RTCToken
20
- */
21
- private _rtcToken;
22
- /**
23
- * 已订阅的资源信息
24
- */
25
- private _liveUrl;
26
- /**
27
- * 已订阅的远端流
28
- */
29
- private readonly _subTracks;
30
- /**
31
- * 客户端传入的数据上报事件
32
- */
33
- private _reportListener;
34
- /**
35
- * 使用的 peerConnection 对应 id
36
- */
37
- private _pcName;
38
- /**
39
- * peerConnection 管理类
40
- */
41
- private _peerCManager;
42
- private readonly _clientSessionId;
43
- constructor(_context: RTCPluginContext, runtime: IRuntime, _initOption: IRCRTCInitOptions,
44
- /**
45
- * 是否使用多 peerConnection
46
- */
47
- _useMutilPeerC?: boolean | undefined);
48
- private _getReqHeaders;
49
- private _clearSubscribeInfo;
50
- private _livingType;
51
- private _mediaType;
52
- private _subTiny;
53
- private _fromRetry;
54
- private _reTryExchange;
55
- /**
56
- * 直播观众订阅主播资源,直播观众端无需加入房间
57
- * @param liveUrl 直播资源地址
58
- * @param livingType 直播类型,有效值为音频、音视频
59
- * @param mediaType 订阅资源类型,其有效值为 `RCMediaType` 的枚举值
60
- * @param subTiny 当值为 `true` 时将订阅小流,否则订阅大流。默认值为 `false`
61
- */
62
- subscribe(liveUrl: string, livingType: RCLivingType, mediaType: RCMediaType, subTiny?: boolean): Promise<{
63
- code: RCRTCCode;
64
- tracks: RCRemoteTrack[];
65
- }>;
66
- private __subscribe;
67
- /**
68
- * 取消订阅主播资源
69
- * @param liveUrl
70
- */
71
- unsubscribe(): Promise<{
72
- code: RCRTCCode;
73
- }>;
74
- private __unsubscribe;
75
- /**
76
- * 注册房间数据监控
77
- * @param listener
78
- * @description 该方法暂仅支持 Chrome 浏览器
79
- */
80
- registerReportListener(listener: IRCRTCReportListener | null): void;
81
- private _appListener;
82
- /**
83
- * 注册流事件监听,多次注册会导致后者覆盖前者,可以通过使用 `registerTrackEventListener(null)` 取消注册
84
- * @param listener
85
- */
86
- registerTrackEventListener(listener: IRCRTCTrackEventListener | null): void;
87
- private _onTrackReady;
88
- }
89
- //# sourceMappingURL=RCAudienceClient.d.ts.map
@@ -1,124 +0,0 @@
1
- import { RCRTCCode } from './enums/RCRTCCode';
2
- import { ICameraVideoProfile, ICreateLocalTrackOptions, IMicphoneAudioProfile, IScreenVideoProfile } from './interfaces';
3
- import { RCCameraVideoTrack, RCLocalAudioTrack, RCLocalFileTrack, RCLocalTrack, RCLocalVideoTrack, RCMicphoneAudioTrack, RCScreenAudioTrack, RCScreenVideoTrack } from './tracks/RCLocalTrack';
4
- import { RTCPluginContext } from '@rongcloud/engine';
5
- export default class RCMediaStreamCapture {
6
- protected readonly _context: RTCPluginContext;
7
- constructor(_context: RTCPluginContext);
8
- private _isElectron;
9
- private _getMediaStream;
10
- /**
11
- * 如果用户设置了音频约束为true,那么我们将音频约束设置为一个空对象,
12
- * 然后我们将检查浏览器是否支持noiseSuppression、autoGainControl和echoCancellation约束,
13
- * 如果支持,那么我们将设置音频约束为真
14
- * @param {any} constraints - 约束参数与 getUserMedia 方法中的约束参数相同。
15
- * @returns 返回值是约束对象。
16
- */
17
- private setConstraintsConfig;
18
- /**
19
- * 从麦克风中捕获音轨数据
20
- * @param tag
21
- * @param options
22
- * @returns
23
- */
24
- createMicrophoneAudioTrack(tag?: string, options?: IMicphoneAudioProfile): Promise<{
25
- code: RCRTCCode;
26
- track?: RCMicphoneAudioTrack;
27
- }>;
28
- /**
29
- * 由摄像头捕获视轨数据
30
- * @param tag
31
- * @param options
32
- * @returns
33
- */
34
- createCameraVideoTrack(tag?: string, options?: ICameraVideoProfile): Promise<{
35
- code: RCRTCCode;
36
- track?: RCCameraVideoTrack;
37
- }>;
38
- /**
39
- * 通过摄像头与麦克风采集音视频轨道数据
40
- * @param tag
41
- * @param options
42
- * @returns
43
- */
44
- createMicrophoneAndCameraTracks(tag?: string, options?: {
45
- audio?: IMicphoneAudioProfile;
46
- video?: ICameraVideoProfile;
47
- }): Promise<{
48
- code: RCRTCCode;
49
- tracks: RCLocalTrack[];
50
- }>;
51
- /**
52
- * 创建屏幕共享视频流,默认分辨率 `1280 * 720`,帧率 `15`
53
- * @param tag 屏幕共享视轨数据标识
54
- * @param options
55
- * @description
56
- * 支持 Electron 平台下通过制定 `chromeMediaSourceId` 的方式获取屏幕共享视频。
57
- * 参考:https://www.electronjs.org/docs/api/desktop-capturer
58
- */
59
- createScreenVideoTrack(tag?: string, options?: IScreenVideoProfile): Promise<{
60
- code: RCRTCCode;
61
- track?: RCScreenVideoTrack;
62
- }>;
63
- /**
64
- * 创建带音频的屏幕共享资源
65
- * @param tag 屏幕共享视轨数据标识
66
- * @param options
67
- * @description electron 中 mac 系统暂不支持屏幕共享采集声音
68
- * @returns 在可以取到音频的情况下,tracks 中包含音轨和视轨;取不到音视频时 tracks 仅返回视轨
69
- */
70
- createScreenWithAudioTracks(tag?: string, options?: IScreenVideoProfile): Promise<{
71
- code: RCRTCCode;
72
- tracks?: (RCScreenVideoTrack | RCScreenAudioTrack)[];
73
- }>;
74
- private _createScreenTracks;
75
- /**
76
- * 创建 RCLocalAudioTrack 实例
77
- * @param tag
78
- * @param track
79
- * @returns
80
- */
81
- createLocalAudioTrack(tag: string, track: MediaStreamTrack): Promise<{
82
- code: RCRTCCode;
83
- track?: RCLocalAudioTrack;
84
- }>;
85
- /**
86
- * 创建 RCLocalVideoTrack 实例
87
- * @param tag 视轨数据标识
88
- * @param track MediaStreamTrack 实例
89
- * @returns
90
- */
91
- createLocalVideoTrack(tag: string, track: MediaStreamTrack): Promise<{
92
- code: RCRTCCode;
93
- track?: RCLocalVideoTrack;
94
- }>;
95
- /**
96
- * 根据本地或网络媒体文件资源创建 `RCLocalFileTrack` 实例
97
- * @param tag 资源标识
98
- * @param file 网络文件地址,或通过 <input type='file'> 获取到的 File 实例
99
- * @param options 可用于指定 `withoutVideo` 与 `withoutAudio` 以剔除视轨与音轨
100
- */
101
- createLocalFileTracks(tag: string, file: string | File, options?: ICreateLocalTrackOptions): Promise<{
102
- code: RCRTCCode;
103
- tracks: RCLocalFileTrack[];
104
- }>;
105
- /**
106
- * 根据 MediaStream 实例对象创建 RCLocalTrack 实例
107
- * @param tag 轨道标识
108
- * @param stream MediaStream 实例
109
- * @param options 可用于指定 `withoutVideo` 与 `withoutAudio` 以剔除视轨与音轨
110
- * @returns
111
- */
112
- createLocalTracks(tag: string, stream: MediaStream, options?: ICreateLocalTrackOptions): Promise<{
113
- code: RCRTCCode;
114
- tracks: RCLocalTrack[];
115
- }>;
116
- /**
117
- * 它接受一个 MediaStream 和一个可选的选项对象并返回一个 MediaStreamTracks 数组
118
- * @param {MediaStream} stream - MediaStream - 从中获取曲目的流。
119
- * @param {ICreateLocalTrackOptions} [options] - ICreateLocalTrackOptions
120
- * @returns 一组 MediaStreamTrack 对象。
121
- */
122
- static getTracksWithOptions(stream: MediaStream, options?: ICreateLocalTrackOptions): Array<MediaStreamTrack | undefined>;
123
- }
124
- //# sourceMappingURL=RCMediaStreamCapture.d.ts.map
@@ -1,126 +0,0 @@
1
- import { ErrorCode, IRuntime, RTCMode, RTCPluginContext, IRTCJoinedInfo, RTCJoinType, IRTCUserData } from '@rongcloud/engine';
2
- import RCLivingRoom from './room/RCLivingRoom';
3
- import RCRTCRoom from './room/RCRTCRoom';
4
- import RCAudienceClient from './RCAudienceClient';
5
- import { IJoinResCDNInfo, IRCRTCInitOptions } from './interfaces';
6
- import RCAbstractRoom from './room/RCAbstractRoom';
7
- import { RCRTCCode } from './enums/RCRTCCode';
8
- import { RCLivingType } from './enums/RCLivingType';
9
- import { RCRemoteTrack } from './tracks/RCRemoteTrack';
10
- import RCAudienceLivingRoom from './room/RCAudienceLivingRoom';
11
- import RCMediaStreamCapture from './RCMediaStreamCapture';
12
- /**
13
- * RTC 业务客户端
14
- * @public
15
- */
16
- export default class RCRTCClient extends RCMediaStreamCapture {
17
- protected readonly _context: RTCPluginContext;
18
- private readonly _runtime;
19
- private readonly _options;
20
- private readonly _service;
21
- constructor(_context: RTCPluginContext, _runtime: IRuntime, _options: IRCRTCInitOptions);
22
- private _handleMessage;
23
- /**
24
- * 获取加入的连麦房间
25
- */
26
- private _getJoinedPKRoomList;
27
- /**
28
- * 获取当前用户 Id,若 IM 未连接,这返回 `''`
29
- * @returns
30
- */
31
- getCurrentId(): string;
32
- private _crtRoom;
33
- /**
34
- * 加入普通音视频房间
35
- * @param roomId
36
- * @param joinType 多端处理方式
37
- * @param outerUserDatas 业务层设置人员属性
38
- * @param useMutilPeerC 是否使用多 peerConnection 发布资源
39
- * @param roomType 加入房间的类型 默认参数 RTCMode.RTC
40
- */
41
- joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean, roomType?: RTCMode): Promise<{
42
- room?: RCRTCRoom;
43
- code: RCRTCCode;
44
- userIds?: string[];
45
- tracks?: RCRemoteTrack[];
46
- }>;
47
- /**
48
- * 主播加入直播房间或观众上麦场景调用,观众上麦之前需先取消已订阅的直播间资源
49
- * @param roomId 房间 Id
50
- * @param livingType 直播间类型,`RCLivingType.AUDIO` 为音频直播,`RCLivingType.VIDEO` 为音视频直播
51
- * @param joinType 多端处理方式,公有云暂不支持该字段
52
- * @param outerUserDatas 业务层设置人员属性
53
- */
54
- joinLivingRoom(roomId: string, livingType: RCLivingType, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean): Promise<{
55
- room?: RCLivingRoom;
56
- code: RCRTCCode;
57
- userIds?: string[];
58
- tracks?: RCRemoteTrack[];
59
- CDNEnable?: boolean;
60
- }>;
61
- private _audience;
62
- /**
63
- * 获取直播观众客户端
64
- */
65
- getAudienceClient(useMutilPeerC?: boolean): RCAudienceClient;
66
- private _onIMStatusChange;
67
- private _onIMDisconnect;
68
- private _onIMUninit;
69
- /**
70
- * 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
71
- */
72
- leaveRoom(room: RCAbstractRoom): Promise<{
73
- code: RCRTCCode;
74
- }>;
75
- private _crtAudienceLivingRoom;
76
- /**
77
- * 观众加入直播房间
78
- * @param roomId 房间 ID
79
- * @param livingType 直播类型(音频直播 or 音视频直播)
80
- */
81
- joinLivingRoomAsAudience(roomId: string, livingType: RCLivingType, useMutilPeerC?: boolean): Promise<{
82
- room?: RCAudienceLivingRoom;
83
- code: RCRTCCode;
84
- userIds?: string[];
85
- RTCTracks?: RCRemoteTrack[];
86
- MCUTracks?: RCRemoteTrack[];
87
- CDNUris?: IJoinResCDNInfo;
88
- }>;
89
- /**
90
- * 观众退出并销毁当前房间实例,退出后该房间的所有方法将不可用
91
- */
92
- leaveLivingRoomAsAudience(room: RCAudienceLivingRoom): Promise<{
93
- code: RCRTCCode;
94
- }>;
95
- /**
96
- * 升级为主播房间
97
- * @param room 观众房间实例
98
- */
99
- upgradeToAnchorRoom(room: RCAudienceLivingRoom): Promise<{
100
- room?: RCLivingRoom;
101
- code: RCRTCCode;
102
- userIds?: string[];
103
- tracks?: RCRemoteTrack[];
104
- }>;
105
- /**
106
- * 降级为观众房间
107
- * @param room 主播房间实例
108
- */
109
- downgradeToAudienceRoom(room: RCLivingRoom): Promise<{
110
- room?: RCAudienceLivingRoom;
111
- code: RCRTCCode;
112
- userIds?: string[];
113
- RTCTracks?: RCRemoteTrack[];
114
- MCUTracks?: RCRemoteTrack[];
115
- CDNUris?: IJoinResCDNInfo;
116
- }>;
117
- /**
118
- * 获取在房间内用户信息
119
- * @since version 5.2.1
120
- */
121
- getJoinedRoomInfo(): Promise<{
122
- code: RCRTCCode | ErrorCode;
123
- data?: IRTCJoinedInfo[];
124
- }>;
125
- }
126
- //# sourceMappingURL=RCRTCClient.d.ts.map
@@ -1,84 +0,0 @@
1
- import { IJoinRTCRoomData, RTCMode, RTCPluginContext } from '@rongcloud/engine';
2
- import { IPublishedResource, ISubscribeAttr, RoomData } from './interfaces';
3
- import PolarisReporter from './PolarisReporter';
4
- import { RCMediaService } from './service';
5
- import { ICDNUris } from './service/interface';
6
- import { RCLocalTrack } from './tracks/RCLocalTrack';
7
- import { RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack } from './tracks/RCRemoteTrack';
8
- import RCRTCPeerCManager from './webrtc/RCRTCPeerCManager';
9
- export declare const StoreEvent: {};
10
- export declare abstract class ReadableStore {
11
- readonly context: RTCPluginContext;
12
- readonly service: RCMediaService;
13
- readonly peerMgr: RCRTCPeerCManager;
14
- readonly roomId: string;
15
- readonly crtUserId: string;
16
- readonly roomMode: RTCMode;
17
- readonly polarisReport: PolarisReporter;
18
- readonly isUpgrade?: boolean | undefined;
19
- readonly isMainRoom?: boolean | undefined;
20
- /**
21
- * 房间资源数据
22
- */
23
- protected _roomResources: RoomData;
24
- /**
25
- * 远端 track
26
- */
27
- protected _remoteTracks: {
28
- [trackId: string]: RCRemoteAudioTrack | RCRemoteVideoTrack;
29
- };
30
- /**
31
- * 已订阅参数
32
- */
33
- protected _subscribedList: ISubscribeAttr[];
34
- protected _collectSubscribeList: ISubscribeAttr[];
35
- /**
36
- * 与 MediaServer 交互需要的 token 信息
37
- */
38
- protected _token: string;
39
- /**
40
- * 每次加入房间后都会改变
41
- */
42
- protected _sessionId: string;
43
- /**
44
- * cdn_uris 信令扩散数据
45
- */
46
- protected _CDNUris: ICDNUris | null;
47
- protected _CDNEnable: boolean;
48
- protected _destroyed: boolean;
49
- constructor(context: RTCPluginContext, service: RCMediaService, peerMgr: RCRTCPeerCManager, roomId: string, crtUserId: string, roomMode: RTCMode, polarisReport: PolarisReporter, isUpgrade?: boolean | undefined, isMainRoom?: boolean | undefined);
50
- get useMutilPeerC(): boolean;
51
- getResourcesByUserId(userId: string): IPublishedResource[] | undefined;
52
- getRemoteTrack(trackId: string): RCRemoteTrack | undefined;
53
- getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
54
- getRemoteTracks(): {
55
- [trackId: string]: RCRemoteAudioTrack | RCRemoteVideoTrack;
56
- };
57
- getSessionId(): string;
58
- getAllUserIds(): string[];
59
- getRemoteUserIds(): string[];
60
- getSubscribedList(): ISubscribeAttr[];
61
- getCollectSubscribeList(): ISubscribeAttr[];
62
- getPublishedResourceByTrackId(trackId: string): IPublishedResource | undefined;
63
- getToken(): string;
64
- getLocalTrack(trackId: string): RCLocalTrack | null;
65
- getLocalTracks(): RCLocalTrack[];
66
- getTrackState(trackId: string): 0 | 1;
67
- getCDNEnable(): boolean;
68
- getCDNUris(): ICDNUris | null;
69
- }
70
- export declare class Store extends ReadableStore {
71
- private _initRemoteTracks;
72
- initWithRoomData(data: IJoinRTCRoomData): void;
73
- assignRoomData(data: RoomData): void;
74
- setResourcesByUserId(userId: string, arr: IPublishedResource[]): void;
75
- removeRemoteTrack(trackId: string): void;
76
- removeResourcesByUserId(userId: string): void;
77
- addRemoteTrack(track: RCRemoteTrack): void;
78
- removeRemoteTracks(): void;
79
- setCDNEnabel(bool: boolean): void;
80
- setCDNUris(uris: ICDNUris | null): void;
81
- resetSubscribedList(subscribeList: ISubscribeAttr[]): void;
82
- resetCollectSubscribeList(collectSubscribeList: ISubscribeAttr[]): void;
83
- }
84
- //# sourceMappingURL=Store.d.ts.map
@@ -1,55 +0,0 @@
1
- import { RCCommandKind } from '../enums/RCCommandKind';
2
- import { RCLinkedListPoint } from '../enums/RCLinkedListPoint';
3
- import { RCRTCCode } from '../enums/RCRTCCode';
4
- import { ISubscribeAttr } from '../interfaces';
5
- import { Store } from '../Store';
6
- import { RCRemoteTrack } from '../tracks/RCRemoteTrack';
7
- import { BaseCommand } from './BaseCommand';
8
- export declare type taskCompletedParams = {
9
- code: RCRTCCode;
10
- subscribe?: ISubscribeAttr[];
11
- unsubscribe?: ISubscribeAttr[];
12
- failedList?: ISubscribeAttr[];
13
- };
14
- export declare type AsyncCommandCallback = {
15
- onTaskCompleted: (content: taskCompletedParams) => void;
16
- };
17
- export declare abstract class AsyncCommand<RES, STORE = Store> extends BaseCommand<RES> {
18
- protected state: RCLinkedListPoint;
19
- constructor(state?: RCLinkedListPoint);
20
- get kind(): RCCommandKind;
21
- /**
22
- * `public setState(状态:RCLinkedListPoint):void`
23
- *
24
- * 该函数是公共的,它被称为 setState,它接受一个称为 state 的参数,它什么也不返回
25
- * @param {RCLinkedListPoint} state - 链表的状态。
26
- */
27
- setState(state: RCLinkedListPoint): void;
28
- static AsyncSubscribeTasks: (RCRemoteTrack | ISubscribeAttr)[];
29
- static AsyncUnsubscribeTasks: (RCRemoteTrack | ISubscribeAttr)[];
30
- static AsyncUpdateSubscribeTasks: (RCRemoteTrack | ISubscribeAttr)[];
31
- /**
32
- * 该功能用于向房间发送消息,任务完成时向房间发送消息
33
- * @param {Store} store - 店铺
34
- * @param {RCRTCCode} code - 任务的状态码,即任务的状态码。
35
- * @param {ISubscribeAttr[]} tracks - 要订阅的Tracks
36
- */
37
- protected pickoutSubscribed(subscribedTracks: ISubscribeAttr[], originTracks: ISubscribeAttr[]): {
38
- subscribe: ISubscribeAttr[];
39
- unsubscribe: ISubscribeAttr[];
40
- };
41
- private calcSubscribeList;
42
- /**
43
- * 它需要一个轨道数组并返回一个轨道数组。
44
- * @param {(RCRemoteTrack | ISubscribeAttr)[]} tracks - (RCRemoteTrack | ISubscribeAttr)[]
45
- * @returns 具有 track 属性的对象数组。
46
- */
47
- protected formateTrack(tracks: (RCRemoteTrack | ISubscribeAttr)[]): ISubscribeAttr[];
48
- /**
49
- * 它检查 Track 是否已经在订阅列表中。
50
- * @param {ISubscribeAttr} track - ISubscribeAttr:要添加到列表中的 track
51
- * @param {ISubscribeAttr[]} tracks - 需要订阅的 track 数组
52
- */
53
- private trackInSubscribeList;
54
- }
55
- //# sourceMappingURL=AsyncCommand.d.ts.map
@@ -1,28 +0,0 @@
1
- import { RCLinkedListPoint } from '../enums/RCLinkedListPoint';
2
- import { RCRTCCode } from '../enums/RCRTCCode';
3
- import { ISubscribeAttr } from '../interfaces';
4
- import { Invoker } from '../Invoker';
5
- import { Store } from '../Store';
6
- import { RCRemoteTrack } from '../tracks/RCRemoteTrack';
7
- import { AsyncCommand, AsyncCommandCallback } from './AsyncCommand';
8
- import { Subscribehook } from './UpdateSubscribeListCommand';
9
- export declare class AsyncSubscribeCommand extends AsyncCommand<{
10
- code: RCRTCCode;
11
- failedList?: ISubscribeAttr[];
12
- }> {
13
- private readonly tracks;
14
- private subhook;
15
- private callbacks;
16
- constructor(tracks: (RCRemoteTrack | ISubscribeAttr)[], subhook: Subscribehook, callbacks: AsyncCommandCallback, state?: RCLinkedListPoint);
17
- execute(store: Store, invoker: Invoker): Promise<{
18
- code: RCRTCCode;
19
- failedList?: ISubscribeAttr[];
20
- }>;
21
- /**
22
- * 如果当前节点的状态为 MIDDLE,则返回 store 的订阅属性列表。否则,返回存储的订阅属性列表
23
- * @param {Store} store
24
- * @returns ISubscribeAttr 对象的数组。
25
- */
26
- private getSubscribedList;
27
- }
28
- //# sourceMappingURL=AsyncSubscribeCommand.d.ts.map
@@ -1,28 +0,0 @@
1
- import { RCLinkedListPoint } from '../enums/RCLinkedListPoint';
2
- import { RCRTCCode } from '../enums/RCRTCCode';
3
- import { ISubscribeAttr } from '../interfaces';
4
- import { Invoker } from '../Invoker';
5
- import { Store } from '../Store';
6
- import { RCRemoteTrack } from '../tracks/RCRemoteTrack';
7
- import { AsyncCommand, AsyncCommandCallback } from './AsyncCommand';
8
- import { Subscribehook } from './UpdateSubscribeListCommand';
9
- export declare class AsyncUnsubscribeCommand extends AsyncCommand<{
10
- code: RCRTCCode;
11
- failedList?: ISubscribeAttr[];
12
- }> {
13
- private tracks;
14
- private subhook;
15
- private callbacks;
16
- constructor(tracks: RCRemoteTrack[], subhook: Subscribehook, callbacks: AsyncCommandCallback, state?: RCLinkedListPoint);
17
- execute(store: Store, invoker: Invoker): Promise<{
18
- code: RCRTCCode;
19
- failedList?: ISubscribeAttr[];
20
- }>;
21
- /**
22
- * 如果当前节点的状态为 MIDDLE,则返回 store 的订阅属性列表。否则,返回存储的订阅属性列表
23
- * @param {Store} store
24
- * @returns ISubscribeAttr 对象的数组。
25
- */
26
- private getSubscribedList;
27
- }
28
- //# sourceMappingURL=AsyncUnsubscribeCommand.d.ts.map
@@ -1,25 +0,0 @@
1
- import { RCLinkedListPoint } from '../enums/RCLinkedListPoint';
2
- import { RCRTCCode } from '../enums/RCRTCCode';
3
- import { ISubscribeAttr } from '../interfaces';
4
- import { Invoker } from '../Invoker';
5
- import { Store } from '../Store';
6
- import { RCRemoteTrack } from '../tracks/RCRemoteTrack';
7
- import { AsyncCommand, AsyncCommandCallback } from './AsyncCommand';
8
- import { Subscribehook } from './UpdateSubscribeListCommand';
9
- /**
10
- * 更新订阅关系,为强制更新订阅关系,传入的 Tracks 都会被订阅
11
- */
12
- export declare class AsyncUpdateSubscribeListCommand extends AsyncCommand<{
13
- code: RCRTCCode;
14
- failedList?: ISubscribeAttr[];
15
- }> {
16
- private readonly tracks;
17
- private subhook;
18
- private callbacks;
19
- constructor(tracks: (RCRemoteTrack | ISubscribeAttr)[], subhook: Subscribehook, callbacks: AsyncCommandCallback, state?: RCLinkedListPoint);
20
- execute(store: Store, invoker: Invoker): Promise<{
21
- code: RCRTCCode;
22
- failedList?: ISubscribeAttr[];
23
- }>;
24
- }
25
- //# sourceMappingURL=AsyncUpdateSubscribeListCommand.d.ts.map