@rongcloud/plugin-rtc 5.2.4 → 5.2.5

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 (63) hide show
  1. package/dist/async-task-queue.d.ts +15 -0
  2. package/dist/core/PolarisReporter.d.ts +35 -0
  3. package/dist/core/RCAudienceClient.d.ts +72 -0
  4. package/dist/core/RCRTCClient.d.ts +208 -0
  5. package/dist/core/constants.d.ts +2 -0
  6. package/dist/core/enums/BackgroundPictureFillMode.d.ts +14 -0
  7. package/dist/core/enums/MixLayoutMode.d.ts +18 -0
  8. package/dist/core/enums/MixVideoRenderMode.d.ts +14 -0
  9. package/dist/core/enums/RCFrameRate.d.ts +7 -0
  10. package/dist/core/enums/RCInnerCDNBroadcast.d.ts +5 -0
  11. package/dist/core/enums/RCInnerCDNModel.d.ts +5 -0
  12. package/dist/core/enums/RCInnerCDNPullIsHttps.d.ts +5 -0
  13. package/dist/core/enums/RCInnerCDNPullKind.d.ts +6 -0
  14. package/dist/core/enums/RCInnerCDNPushMode.d.ts +5 -0
  15. package/dist/core/enums/RCKickType.d.ts +11 -0
  16. package/dist/core/enums/RCLivingType.d.ts +14 -0
  17. package/dist/core/enums/RCMediaType.d.ts +18 -0
  18. package/dist/core/enums/RCRTCCode.d.ts +89 -0
  19. package/dist/core/enums/RCRTCLiveRole.d.ts +14 -0
  20. package/dist/core/enums/RCRTCPingResult.d.ts +5 -0
  21. package/dist/core/enums/RCRTCResolution.d.ts +100 -0
  22. package/dist/core/enums/RCResolution.d.ts +16 -0
  23. package/dist/core/enums/inner/PolarisRole.d.ts +14 -0
  24. package/dist/core/enums/inner/R2Action.d.ts +14 -0
  25. package/dist/core/enums/inner/R2Status.d.ts +11 -0
  26. package/dist/core/enums/inner/RCRTCMessageType.d.ts +42 -0
  27. package/dist/core/enums/inner/RCStreamType.d.ts +14 -0
  28. package/dist/core/enums/inner/TrackState.d.ts +14 -0
  29. package/dist/core/interfaces.d.ts +673 -0
  30. package/dist/core/room/Pinger.d.ts +32 -0
  31. package/dist/core/room/RCAbstractRoom.d.ts +351 -0
  32. package/dist/core/room/RCAudienceLivingRoom.d.ts +305 -0
  33. package/dist/core/room/RCAudioLevelReport.d.ts +17 -0
  34. package/dist/core/room/RCLivingRoom.d.ts +93 -0
  35. package/dist/core/room/RCLocalMediaStream.d.ts +8 -0
  36. package/dist/core/room/RCMCUConfigBuilder.d.ts +163 -0
  37. package/dist/core/room/RCRTCRoom.d.ts +11 -0
  38. package/dist/core/service/RCMediaService.d.ts +96 -0
  39. package/dist/core/service/helper.d.ts +8 -0
  40. package/dist/core/service/index.d.ts +6 -0
  41. package/dist/core/service/interface.d.ts +311 -0
  42. package/dist/core/service/mcu-interface.d.ts +263 -0
  43. package/dist/core/tracks/RCLocalTrack.d.ts +108 -0
  44. package/dist/core/tracks/RCRemoteTrack.d.ts +23 -0
  45. package/dist/core/tracks/RCTrack.d.ts +80 -0
  46. package/dist/core/webrtc/ASdpStrategy.d.ts +43 -0
  47. package/dist/core/webrtc/PlanBStrategy.d.ts +25 -0
  48. package/dist/core/webrtc/RCRTCPeerConnection.d.ts +80 -0
  49. package/dist/core/webrtc/UnifiedPlanStrategy.d.ts +20 -0
  50. package/dist/core/webrtc/helper.d.ts +26 -0
  51. package/dist/core/webrtc/stat-parser/AbstractStatParser.d.ts +116 -0
  52. package/dist/core/webrtc/stat-parser/ChromeStatParser.d.ts +14 -0
  53. package/dist/core/webrtc/stat-parser/FirefoxStatParser.d.ts +14 -0
  54. package/dist/core/webrtc/stat-parser/IStatParser.d.ts +24 -0
  55. package/dist/core/webrtc/stat-parser/SafariStatParser.d.ts +14 -0
  56. package/dist/device.d.ts +6 -0
  57. package/dist/helper.d.ts +168 -0
  58. package/dist/index.d.ts +3 -3
  59. package/dist/index.esm.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/index.umd.js +1 -1
  62. package/dist/logger.d.ts +4 -0
  63. package/package.json +2 -2
@@ -0,0 +1,93 @@
1
+ import { IJoinRTCRoomData, RTCPluginContext, IRuntime } from '@rongcloud/engine';
2
+ import { RCRTCCode } from '../enums/RCRTCCode';
3
+ import { IRCRTCInitOptions, IPublishedResource } from '../interfaces';
4
+ import { RCMediaService, ICDNUris, IExchangeReqBody } from '../service';
5
+ import RCAbstractRoom from './RCAbstractRoom';
6
+ import RCMCUConfigBuilder from './RCMCUConfigBuilder';
7
+ import { RCLivingType } from '../enums/RCLivingType';
8
+ import { RCInnerCDNPushMode } from '../enums/RCInnerCDNPushMode';
9
+ /**
10
+ * 直播房间
11
+ */
12
+ export default class RCLivingRoom extends RCAbstractRoom {
13
+ private _livingType;
14
+ readonly _mcuConfigBuilder: RCMCUConfigBuilder;
15
+ /**
16
+ * cdn_uris 信令扩散数据
17
+ */
18
+ private _CDNUris;
19
+ private _CDNEnable;
20
+ constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function, _livingType: RCLivingType, isUpgrage?: boolean);
21
+ getLivingType(): RCLivingType;
22
+ /**
23
+ * 获取 MCU 配置构建对象
24
+ */
25
+ getMCUConfigBuilder(): RCMCUConfigBuilder;
26
+ /**
27
+ * 接收 MCU 配置并向 MediaServer 提交
28
+ * @param data
29
+ */
30
+ private _onMCUConfigFlush;
31
+ /**
32
+ * 主播端断线重连后,需更新内存中的 CDN 数据
33
+ * 判断房间内 CDN 状态是否和内存数据一致,不一致时需通知到客户端
34
+ */
35
+ __onReconnected(): Promise<void>;
36
+ /**
37
+ * 开启/停用推 CDN
38
+ */
39
+ enableInnerCDN(enable: boolean): Promise<{
40
+ code: RCRTCCode;
41
+ }>;
42
+ /**
43
+ * 开启、停用 CDN 推资源后发信令
44
+ */
45
+ private _sendCDNInfoSignal;
46
+ /**
47
+ * 扩散 cdn_uris 资源
48
+ */
49
+ private _spreadCDNInfo;
50
+ /**
51
+ * 给房间设置 CDN 数据
52
+ */
53
+ private _setRoomCDNInfo;
54
+ /**
55
+ * 资源变化时触发
56
+ * 直播房间需单独处理 cdn_uris
57
+ */
58
+ protected _resourceHandle(content: {
59
+ /**
60
+ * 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
61
+ * * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
62
+ * * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
63
+ */
64
+ ignore?: boolean;
65
+ /**
66
+ * 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
67
+ */
68
+ uris: IPublishedResource[];
69
+ cdn_uris?: ICDNUris[];
70
+ }, messageType: string, userId: string): Promise<void>;
71
+ /**
72
+ * 重写父类 _exchangeHandle 方法
73
+ */
74
+ protected _exchangeHandle(body: IExchangeReqBody): Promise<{
75
+ code: RCRTCCode;
76
+ data?: import("../service").IExchangeResponse | undefined;
77
+ }>;
78
+ /**
79
+ * 观众切换为主播后直接处理人员变更及资源变更
80
+ */
81
+ protected _afterChangedRole(data: IJoinRTCRoomData): void;
82
+ /**
83
+ * 返回 CDN 是否可用
84
+ * @returns boolean
85
+ */
86
+ __getCDNEnable(): boolean | undefined;
87
+ /**
88
+ * 返回 CDN 推送模式: 自动 or 手动
89
+ * @returns boolean
90
+ */
91
+ __getCDNPushMode(): RCInnerCDNPushMode | undefined;
92
+ }
93
+ //# sourceMappingURL=RCLivingRoom.d.ts.map
@@ -0,0 +1,8 @@
1
+ export default class RCLocalMediaStream {
2
+ readonly msid: string;
3
+ readonly mediaStream: MediaStream;
4
+ readonly tinyStream: MediaStream;
5
+ readonly tag: string;
6
+ constructor(msid: string);
7
+ }
8
+ //# sourceMappingURL=RCLocalMediaStream.d.ts.map
@@ -0,0 +1,163 @@
1
+ import { BackgroundPictureFillMode } from '../enums/BackgroundPictureFillMode';
2
+ import { MixLayoutMode } from '../enums/MixLayoutMode';
3
+ import { MixVideoRenderMode } from '../enums/MixVideoRenderMode';
4
+ import { RCFrameRate } from '../enums/RCFrameRate';
5
+ import { RCResolution } from '../enums/RCResolution';
6
+ import { RCRTCCode } from '../enums/RCRTCCode';
7
+ import { IMCUConfig } from '../service';
8
+ export default class RCMCUConfigBuilder {
9
+ /**
10
+ * flush 提交回调
11
+ */
12
+ private readonly _onFlush;
13
+ /**
14
+ * trackId 有效性验证方法
15
+ */
16
+ private readonly _isValidTrackId;
17
+ /**
18
+ * 扩散 cdn_uris
19
+ */
20
+ private readonly _sendCDNInfoSignal;
21
+ /**
22
+ * mcu 配置数据,每次向服务器提交全量数据
23
+ */
24
+ private _values;
25
+ constructor(
26
+ /**
27
+ * flush 提交回调
28
+ */
29
+ _onFlush: (config: IMCUConfig) => Promise<{
30
+ code: RCRTCCode;
31
+ }>,
32
+ /**
33
+ * trackId 有效性验证方法
34
+ */
35
+ _isValidTrackId: (trackId: string) => boolean,
36
+ /**
37
+ * 扩散 cdn_uris
38
+ */
39
+ _sendCDNInfoSignal: () => void);
40
+ /**
41
+ * 设置合流后的主位置显示的视频流
42
+ * @param videoTrackId 视频流资源 Id
43
+ */
44
+ setHostVideoTrack(videoTrackId: string): RCMCUConfigBuilder;
45
+ /**
46
+ * 设置合流布局模式,当使用 `MixLayoutMode.CUSTOMIZE` 模式时,需自定义合流结构
47
+ * @param mode
48
+ * * `MixLayoutMode.CUSTOMIZE`: 自定义布局,需用户设置布局结构
49
+ * * `MixLayoutMode.SUSPENSION`: 悬浮布局(默认)
50
+ * * `MixLayoutMode.ADAPTATION`: 自适应布局
51
+ */
52
+ setMixLayoutMode(mode: MixLayoutMode): RCMCUConfigBuilder;
53
+ private _addOutputValue;
54
+ /**
55
+ * 设置合流输出视频流的分辨率
56
+ * @param resulution 有效值为 `RCResolution` 定义的枚举值
57
+ */
58
+ setOutputVideoResolution(resolution: RCResolution): RCMCUConfigBuilder;
59
+ /**
60
+ * 设置合流输出视频流的帧率
61
+ * @param fps 其有效值为 `RCFrameRate` 中定义的枚举值
62
+ */
63
+ setOutputVideoFPS(fps: RCFrameRate): RCMCUConfigBuilder;
64
+ /**
65
+ * 设置合流输出视频流的码率(不推荐主动修改)
66
+ * @param bitrate
67
+ */
68
+ setOutputVideoBitrate(bitrate: number): RCMCUConfigBuilder;
69
+ /**
70
+ * 设置合流后输出视频流小流的分辨率
71
+ * @param resulution 有效值为 `RCResolution` 定义的枚举值
72
+ */
73
+ setOutputTinyVideoResolution(resolution: RCResolution): RCMCUConfigBuilder;
74
+ /**
75
+ * 设置合流输出视频流小流的帧率
76
+ * @param fps 其有效值为 `RCFrameRate` 中定义的枚举值
77
+ */
78
+ setOutputTinyVideoFPS(fps: RCFrameRate): RCMCUConfigBuilder;
79
+ /**
80
+ * 设置合流输出视频流小流的码率(不推荐主动修改)
81
+ * @param bitrate
82
+ */
83
+ setOutputTinyVideoBitrate(bitrate: number): RCMCUConfigBuilder;
84
+ /**
85
+ * 设置合流后的视频流渲染方式
86
+ * @param renderMode
87
+ */
88
+ setOutputVideoRenderMode(renderMode: MixVideoRenderMode): RCMCUConfigBuilder;
89
+ /**
90
+ * 设置合流后音频流的编码参数(不推荐主动修改)
91
+ * @param bitrate 音频码率
92
+ */
93
+ setOutputAudioBitrate(bitrate: number): RCMCUConfigBuilder;
94
+ /**
95
+ * 设置合流后的视频流的背景色,默认为 `0x000000`
96
+ * @param color 颜色参数,为 16 进制标识法,如 '0x000000'
97
+ */
98
+ setOutputBackgroundColor(color: string): RCMCUConfigBuilder;
99
+ /**
100
+ * 向合流后的视频流中增加背景图片
101
+ * @param uri 图片资源的完整下载地址
102
+ * @param x 相对于整体画布的起始位置 x 坐标(百分比),有效值 `0.0` - `1.0`
103
+ * @param y 相对于整体画布的起始位置 y 坐标(百分比),有效值 `0.0` - `1.0`
104
+ * @param w 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
105
+ * @param h 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
106
+ */
107
+ addOutputBackgroundPicture(uri: string, x: number, y: number, w: number, h: number): RCMCUConfigBuilder;
108
+ /**
109
+ * 移除对合流后的视频流中添加的指定背景图片
110
+ * @param uri
111
+ */
112
+ removeOutputBackgroundPicture(uri: string): RCMCUConfigBuilder;
113
+ /**
114
+ * 清理对合流后的视频流中添加的所有背景图片
115
+ */
116
+ clearOutputBackgroundPicture(): RCMCUConfigBuilder;
117
+ /**
118
+ * 设置合流后的视频流中添加的背景图片的填充方式:
119
+ * 1. 按比例裁剪
120
+ * 2. 不裁剪,按比例压缩
121
+ * @param fillMode
122
+ */
123
+ setOutputBackgroundPictureFillMode(fillMode: BackgroundPictureFillMode): RCMCUConfigBuilder;
124
+ /**
125
+ * 设置直播 CDN 旁路推流地址,最多支持 5 个推流地址
126
+ * @param urls 地址列表
127
+ */
128
+ addPublishStreamUrls(urls: string[]): RCMCUConfigBuilder;
129
+ /**
130
+ * 移除直播 CDN 旁路推流地址
131
+ * @param urls
132
+ */
133
+ removePublishStreamUrls(urls: string[]): RCMCUConfigBuilder;
134
+ /**
135
+ * 清理已添加的 CDN 旁路推流地址
136
+ */
137
+ clearPublishStreamUrls(): RCMCUConfigBuilder;
138
+ /**
139
+ * 在自定义布局中增加视频流配置
140
+ * @param trackId 资源 Id
141
+ * @param x 在画布中的坐标 x
142
+ * @param y 在画布中的坐标 y
143
+ * @param width 分辨率宽度
144
+ * @param height 分辨率高度
145
+ */
146
+ addCustomizeLayoutVideo(trackId: string, x: number, y: number, width: number, height: number): RCMCUConfigBuilder;
147
+ /**
148
+ * 移除自定义布局中的视频流配置
149
+ * @param trackId
150
+ */
151
+ removeCustomizeLayoutVideo(trackId: string): RCMCUConfigBuilder;
152
+ /**
153
+ * 清除已添加的自定义布局中的视频流配置
154
+ */
155
+ clearCustomizeLayoutVideo(): RCMCUConfigBuilder;
156
+ /**
157
+ * 使已修改的配置生效,在调用该方法前,所有数据只会对本地配置进行修改,不会产生实际效果
158
+ */
159
+ flush(): Promise<{
160
+ code: RCRTCCode;
161
+ }>;
162
+ }
163
+ //# sourceMappingURL=RCMCUConfigBuilder.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { IJoinRTCRoomData, RTCPluginContext, IRuntime } from '@rongcloud/engine';
2
+ import { IRCRTCInitOptions } from '../interfaces';
3
+ import RCMediaService from '../service/RCMediaService';
4
+ import RCAbstractRoom from './RCAbstractRoom';
5
+ /**
6
+ * 普通音视频房间
7
+ */
8
+ export default class RCRTCRoom extends RCAbstractRoom {
9
+ constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function);
10
+ }
11
+ //# sourceMappingURL=RCRTCRoom.d.ts.map
@@ -0,0 +1,96 @@
1
+ import { IRuntime, RTCPluginContext } from '@rongcloud/engine';
2
+ import { RCRTCCode } from '../enums/RCRTCCode';
3
+ import { IRTCReqHeader, IExchangeReqBody, IExchangeResponse, IMCUReqHeaders, IBroadcastSubReqBody, IBroadcastSubRespBody, ICDNPlayUrlReqHeaders, ICDNPlayUrlResponse } from './interface';
4
+ import { IMCUConfig, ISetEnableCDN } from './mcu-interface';
5
+ export default class RCMediaService {
6
+ private readonly _runtime;
7
+ private readonly _context;
8
+ /**
9
+ * 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
10
+ */
11
+ private readonly _msUrl?;
12
+ /**
13
+ * 请求超时时长
14
+ */
15
+ private readonly _timeout;
16
+ /**
17
+ * navi 中获取的媒体服务地址
18
+ */
19
+ private readonly _msInNavi;
20
+ /**
21
+ * 已失败的请求地址
22
+ */
23
+ private readonly _failedMs;
24
+ /**
25
+ * 服务器指纹数据,客户端不得修改,直接透传
26
+ */
27
+ private _rtcFinger;
28
+ /**
29
+ * 服务器接口返回的 clusterId 数据,当此数据有值时,后续所有请求向此服务发送
30
+ */
31
+ private _clusterId;
32
+ /**
33
+ * MCU 服务地址
34
+ */
35
+ private _configUrl;
36
+ constructor(_runtime: IRuntime, _context: RTCPluginContext,
37
+ /**
38
+ * 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
39
+ */
40
+ _msUrl?: string | undefined,
41
+ /**
42
+ * 请求超时时长
43
+ */
44
+ _timeout?: number);
45
+ getNaviMS(): string[];
46
+ /**
47
+ * 发送请求,请求发送若失败,会继续尝试使用后续可用地址直到无地址可用,此时认为请求失败
48
+ * @param path
49
+ * @param header
50
+ * @param body
51
+ */
52
+ private _request;
53
+ /**
54
+ * 资源协商接口,订阅、发布、变更资源均可以使用此接口。该接口通过 sdp 字段交换 SDP 信息,
55
+ * 并通过 subscribeList 和 publishList 表明最终发布和订阅的资源。本端产出 offer,服务器产出 answer
56
+ * 每次接口调用,都会全量覆盖发布和订阅的资源。
57
+ * @param header
58
+ * @param body
59
+ */
60
+ exchange(headers: IRTCReqHeader, body: IExchangeReqBody): Promise<{
61
+ code: RCRTCCode;
62
+ data?: IExchangeResponse | undefined;
63
+ }>;
64
+ /**
65
+ * 退出房间
66
+ */
67
+ exit(headers: IRTCReqHeader): Promise<RCRTCCode>;
68
+ /**
69
+ * 观众端订阅主播资源
70
+ */
71
+ broadcastSubscribe(headers: IRTCReqHeader, body: IBroadcastSubReqBody): Promise<{
72
+ code: RCRTCCode;
73
+ data?: IBroadcastSubRespBody | undefined;
74
+ }>;
75
+ /**
76
+ * 观众端退出订阅
77
+ */
78
+ broadcastExit(headers: IRTCReqHeader): Promise<{
79
+ code: RCRTCCode;
80
+ }>;
81
+ /**
82
+ * 直播推流、自定义布局配置
83
+ */
84
+ setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig | ISetEnableCDN): Promise<{
85
+ code: RCRTCCode;
86
+ res?: any;
87
+ }>;
88
+ /**
89
+ * 房间内观众获取 CDN 资源信息、拉流地址
90
+ */
91
+ getCDNResourceInfo(headers: ICDNPlayUrlReqHeaders, url: string): Promise<{
92
+ code: RCRTCCode;
93
+ res?: ICDNPlayUrlResponse;
94
+ }>;
95
+ }
96
+ //# sourceMappingURL=RCMediaService.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { INaviInfo } from '@rongcloud/engine';
2
+ export declare const getUUID: () => string;
3
+ /**
4
+ * 解析导航数据获取 RTC Server 地址
5
+ * @param info
6
+ */
7
+ export declare const parseNaviInfo: (info: INaviInfo | null) => string[];
8
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1,6 @@
1
+ import RCMediaService from './RCMediaService';
2
+ export { RCMediaService };
3
+ export * from './helper';
4
+ export * from './interface';
5
+ export * from './mcu-interface';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,311 @@
1
+ import { RTCMode } from '@rongcloud/engine';
2
+ import { RCRTCCode } from '../enums/RCRTCCode';
3
+ import { RCMediaType } from '../enums/RCMediaType';
4
+ import { RCStreamType } from '../enums/inner/RCStreamType';
5
+ import { IResource } from '../interfaces';
6
+ import { IOfferInfo } from '../webrtc/ASdpStrategy';
7
+ import { RCInnerCDNPushMode } from '../enums/RCInnerCDNPushMode';
8
+ import { RCInnerCDNBroadcast } from '../enums/RCInnerCDNBroadcast';
9
+ /**
10
+ * 与 MediaServer 交互所需的 Request Header 信息
11
+ */
12
+ export interface IRTCReqHeader {
13
+ /**
14
+ * RTC Token
15
+ * @todo 有效期问题处理
16
+ */
17
+ Token: string;
18
+ /**
19
+ * 房间 Id
20
+ */
21
+ RoomId: string;
22
+ /**
23
+ * 用户 Id
24
+ */
25
+ UserId: string;
26
+ /**
27
+ * 仅在直播模式下需要
28
+ */
29
+ RoomType?: RTCMode;
30
+ /**
31
+ * 开发者的 AppKey
32
+ */
33
+ 'App-Key': string;
34
+ /**
35
+ * signal 会话 session id
36
+ */
37
+ 'Session-Id'?: string;
38
+ }
39
+ export interface IMCUReqHeaders {
40
+ 'App-Key': string;
41
+ Token: string;
42
+ RoomId: string;
43
+ UserId: string;
44
+ SessionId: string;
45
+ }
46
+ /**
47
+ * exchange 接口的请求体结构
48
+ */
49
+ export interface IExchangeReqBody {
50
+ /**
51
+ * local description
52
+ */
53
+ sdp: IOfferInfo;
54
+ /**
55
+ * 订阅列表
56
+ */
57
+ subscribeList: {
58
+ /**
59
+ * 流资源 uri
60
+ */
61
+ uri: string;
62
+ /**
63
+ * 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
64
+ */
65
+ simulcast: RCStreamType;
66
+ /**
67
+ * 分辨率信息
68
+ */
69
+ resolution: string;
70
+ }[];
71
+ /**
72
+ * 透传参数,一般用于传递参数给其他服务,如 MCU/Record 等,MediaServer 仅透传不处理
73
+ * @example `{"resolutionInfo":[{"trackId":"021ad6e8-a50c-479c-96c8-5f3f09d2352d","simulcast":1,"resolution":"640x480"}]}`
74
+ */
75
+ extend: string;
76
+ /**
77
+ * 跨房间连麦时其他房间的推流信息
78
+ */
79
+ pushOtherRooms?: {
80
+ /**
81
+ * 房间 Id
82
+ */
83
+ roomId: string;
84
+ /**
85
+ * 是否默认合流
86
+ */
87
+ automix: boolean;
88
+ /**
89
+ * 房间 Id 对应的 SessionId
90
+ */
91
+ sessionId: string;
92
+ }[];
93
+ /**
94
+ * server 根据网络动态切换大小流开关,默认为 `false`
95
+ */
96
+ switchstream: boolean;
97
+ }
98
+ export interface ILiveUrls {
99
+ /**
100
+ * MCU 服务地址,直播模式中用于向 MCU 服务提交 CDN 及合流配置
101
+ */
102
+ configUrl: string;
103
+ /**
104
+ * 观众端订阅地址,由业务层分发
105
+ */
106
+ liveUrl: string;
107
+ /**
108
+ * 自动推 CDN 模式下,发布资源后返回的 CDN 信息
109
+ */
110
+ pull_url?: string;
111
+ }
112
+ export interface IRTCResponse {
113
+ /**
114
+ * 请求响应码,只有在 resultCode 值为 `10000` 时才为正常响应
115
+ */
116
+ resultCode: RCRTCCode;
117
+ /**
118
+ * 与 resultCode 相应的可读性文字信息
119
+ */
120
+ message: string;
121
+ /**
122
+ * 客户端发送的 Request-Id
123
+ */
124
+ 'Request-Id': string;
125
+ }
126
+ /**
127
+ * /exchange 响应结果
128
+ */
129
+ export interface IExchangeResponse extends IRTCResponse {
130
+ /**
131
+ * 数据中心地址,当存在此值时,后续所有请求发送到该地址。该地址不携带协议头,故需要补全 `https://` 协议头
132
+ */
133
+ clusterId: string;
134
+ /**
135
+ * 发布的资源列表
136
+ */
137
+ publishList: IResource[];
138
+ /**
139
+ * @deprecated 目前并未使用,服务器返回值为 ''
140
+ */
141
+ roomId: '';
142
+ /**
143
+ * 远端 SDP 数据
144
+ */
145
+ sdp: {
146
+ type: 'answer';
147
+ sdp: string;
148
+ };
149
+ /**
150
+ * 直播模式推流数据,仅在直播模式有值
151
+ */
152
+ urls?: ILiveUrls;
153
+ /**
154
+ * 跨房间连麦响应数据
155
+ */
156
+ otherRoomsRes?: {
157
+ [roomId: string]: ILiveUrls;
158
+ };
159
+ /**
160
+ * 直播 mcu 资源
161
+ * 主播发布为具体资源,会议模式为空数组
162
+ */
163
+ mcuPublishList?: IResource[];
164
+ /**
165
+ * 订阅成功的资源
166
+ */
167
+ subscribedList?: {
168
+ mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
169
+ msid: string;
170
+ userId: string;
171
+ simulcast?: RCStreamType;
172
+ }[];
173
+ }
174
+ export interface ICallEngine3 {
175
+ engineType: 3;
176
+ vendorKey: string;
177
+ signKey: string;
178
+ blinkSnifferServer: string;
179
+ blinkCMPServer: string;
180
+ }
181
+ export interface ICallEngine4 {
182
+ engineType: 4;
183
+ /**
184
+ * 房间所有人发布的最大流数量总上限,当前未启用
185
+ */
186
+ maxStreamCount?: number;
187
+ mediaServer: string;
188
+ backupMediaServer?: string[];
189
+ /**
190
+ * 到 mediaServer 的请求超时时限,默认 10,有效值 10 - 30。单位:秒
191
+ */
192
+ timeOut?: number;
193
+ }
194
+ export interface IBroadcastSubReqBody {
195
+ /**
196
+ * 客户端 offer
197
+ */
198
+ sdp: {
199
+ type: 'offer';
200
+ sdp: string;
201
+ };
202
+ /**
203
+ * 直播信息
204
+ */
205
+ liveUrl?: string;
206
+ /**
207
+ * 订阅的资源类型,默认为 `RCMediaType.AUDIO_VIDEO`
208
+ */
209
+ mediaType?: RCMediaType;
210
+ /**
211
+ * 订阅大/小流,默认订阅大流
212
+ */
213
+ simulcast?: RCStreamType;
214
+ /**
215
+ * 允许 server 根据网络状况动态切换大小流,默认为 false
216
+ */
217
+ switchstream: boolean;
218
+ /**
219
+ * 订阅列表
220
+ */
221
+ subscribeList?: {
222
+ /**
223
+ * 流资源 uri
224
+ */
225
+ uri: string;
226
+ /**
227
+ * 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
228
+ */
229
+ simulcast: RCStreamType;
230
+ /**
231
+ * 分辨率信息
232
+ */
233
+ resolution: string;
234
+ }[];
235
+ /**
236
+ * 是否采用新版本模式,加入房间
237
+ */
238
+ newVersionFlag?: boolean;
239
+ }
240
+ export interface IBroadcastSubRespBody extends IRTCResponse {
241
+ /**
242
+ * 已订阅的资源列表
243
+ */
244
+ subscribedList: IResource[];
245
+ /**
246
+ * 远端 SDP
247
+ */
248
+ sdp: {
249
+ type: 'answer';
250
+ sdp: string;
251
+ };
252
+ }
253
+ /**
254
+ * 获取 CDN 资源拉流地址请求 headers
255
+ */
256
+ export interface ICDNPlayUrlReqHeaders extends IMCUReqHeaders {
257
+ }
258
+ /**
259
+ * 获取 CDN 拉流地址的请求参数
260
+ */
261
+ export interface ICDNPlayUrlReq {
262
+ w?: number;
263
+ h?: number;
264
+ fps?: number;
265
+ }
266
+ /**
267
+ * 获取 CDN 资源拉流地址响应
268
+ */
269
+ export interface ICDNPlayUrlResponse extends IRTCResponse {
270
+ data: {
271
+ fps: number;
272
+ h: number;
273
+ 'pull_url': string;
274
+ w: number;
275
+ };
276
+ }
277
+ /**
278
+ * cdn_uris 里面包含的字段
279
+ */
280
+ export interface ICDNUris {
281
+ /**
282
+ * 是否扩散
283
+ */
284
+ broadcast: RCInnerCDNBroadcast;
285
+ /**
286
+ * 拉流资源的宽度
287
+ */
288
+ w?: number;
289
+ /**
290
+ * 拉流资源的高度
291
+ */
292
+ h?: number;
293
+ /**
294
+ * 帧率
295
+ */
296
+ fps?: number;
297
+ /**
298
+ * 获取拉流地址的 url
299
+ */
300
+ url: string;
301
+ /**
302
+ * 开启、停用 CDN
303
+ */
304
+ enableInnerCDN?: boolean;
305
+ /**
306
+ * 推送模式,手动 or 自动
307
+ */
308
+ 'push_mode': RCInnerCDNPushMode;
309
+ 'pull_safe': boolean;
310
+ }
311
+ //# sourceMappingURL=interface.d.ts.map