trtc-sdk-v5 5.1.1-beta.1 → 5.1.1

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/index.d.ts CHANGED
@@ -263,6 +263,42 @@ declare const TRTCType: {
263
263
  */
264
264
  readonly QOS_PREFERENCE_CLEAR: "clear";
265
265
  };
266
+ declare interface AudioMixerOptions {
267
+ id: string;
268
+ url: string;
269
+ loop?: boolean;
270
+ volume?: number;
271
+ }
272
+ declare interface UpdateAudioMixerOptions {
273
+ id: string;
274
+ loop?: boolean;
275
+ volume?: number;
276
+ seekFrom?: number;
277
+ operation?: 'pause' | 'resume' | 'stop';
278
+ }
279
+ declare interface StopAudioMixerOptions {
280
+ id: string;
281
+ }
282
+ declare interface AIDenoiserOptions {
283
+ assetsPath: string;
284
+ sdkAppId: number;
285
+ userId: string;
286
+ userSig: string;
287
+ }
288
+ declare type PluginStartOptionsMap = {
289
+ 'AudioMixer': AudioMixerOptions;
290
+ 'AIDenoiser': AIDenoiserOptions;
291
+ 'CDNStreaming': CDNStreamingOptions;
292
+ };
293
+ declare type PluginUpdateOptionsMap = {
294
+ 'AudioMixer': UpdateAudioMixerOptions;
295
+ 'CDNStreaming': CDNStreamingOptions;
296
+ };
297
+ declare type PluginStopOptionsMap = {
298
+ 'AudioMixer': StopAudioMixerOptions;
299
+ 'AIDenoiser': undefined;
300
+ 'CDNStreaming': CDNStreamingOptions;
301
+ };
266
302
 
267
303
  /**
268
304
  * **TRTC事件列表**<br>
@@ -892,41 +928,46 @@ declare interface TRTCEventTypes {
892
928
  * @typedef {object|string} VideoProfile - 本地视频流配置
893
929
  *
894
930
  * 视频配置参数,可以用字符串预设值或者自定义分辨率等参数
895
- * | 视频 Profile | 分辨率(宽 x 高)| 帧率(fps)| 码率(kbps)| 备注 |
896
- * | :--- | :--- | :--- | :--- | :--- |
897
- * | 120p | 160 x 120 | 15 | 200 ||
898
- * | 180p | 320 x 180 | 15 | 350 ||
899
- * | 240p | 320 x 240 | 15 | 400 ||
900
- * | 360p | 640 x 360 | 15 | 800 ||
901
- * | 480p | 640 x 480 | 15 | 900 ||
902
- * | 720p | 1280 x 720 | 15 | 1500 ||
903
- * | 1080p | 1920 x 1080 | 15 | 2000 ||
904
- * | 1440p | 2560 x 1440 | 30 | 4860 ||
905
- * | 4K | 3840 x 2160 | 30 | 9000 ||
931
+ * | 视频 Profile | 分辨率(宽 x 高)| 帧率(fps)| 码率(kbps)| 备注 |
932
+ * | :--- | :--- | :--- | :--- | :--- |
933
+ * | 120p | 160 x 120 | 15 | 200 ||
934
+ * | 120p_2 | 160 x 120 | 15 | 100 | v5.1.1+ 支持 |
935
+ * | 180p | 320 x 180 | 15 | 350 ||
936
+ * | 180p_2 | 320 x 180 | 15 | 150 | v5.1.1+ 支持 |
937
+ * | 240p | 320 x 240 | 15 | 400 ||
938
+ * | 240p_2 | 320 x 240 | 15 | 200 | v5.1.1+ 支持 |
939
+ * | 360p | 640 x 360 | 15 | 800 ||
940
+ * | 360p_2 | 640 x 360 | 15 | 400 | v5.1.1+ 支持 |
941
+ * | 480p | 640 x 480 | 15 | 900 ||
942
+ * | 480p_2 | 640 x 480 | 15 | 500 | v5.1.1+ 支持 |
943
+ * | 720p | 1280 x 720 | 15 | 1500 ||
944
+ * | 1080p | 1920 x 1080 | 15 | 2000 ||
945
+ * | 1440p | 2560 x 1440 | 30 | 4860 ||
946
+ * | 4K | 3840 x 2160 | 30 | 9000 ||
906
947
  * @property {number} width - 视频宽度
907
948
  * @property {number} height - 视频高度
908
949
  * @property {number} frameRate - 视频帧率
909
950
  * @property {number} bitrate - 视频码率
910
- * @example
911
- * const config = {
912
- * option: {
913
- * profile: '480p',
914
- * },
915
- * }
916
- * await trtc.startLocalVideo(config);
917
- * @example
918
- * const config = {
919
- * option: {
920
- * profile: {
921
- * width: 640,
922
- * height: 480,
923
- * frameRate: 15,
924
- * bitrate: 900,
925
- * }
926
- * }
927
- * }
928
- * await trtc.startLocalVideo(config);
929
- */
951
+ * @example
952
+ * const config = {
953
+ * option: {
954
+ * profile: '480p_2',
955
+ * },
956
+ * }
957
+ * await trtc.startLocalVideo(config);
958
+ * @example
959
+ * const config = {
960
+ * option: {
961
+ * profile: {
962
+ * width: 640,
963
+ * height: 480,
964
+ * frameRate: 15,
965
+ * bitrate: 500,
966
+ * }
967
+ * }
968
+ * }
969
+ * await trtc.startLocalVideo(config);
970
+ */
930
971
  /**
931
972
  * 开启本地摄像头采集,在您指定的 HTMLElement 标签下播放摄像头画面,并将摄像头画面发布到当前所在房间中。
932
973
  * - 调用时机:进房前后均可调用,不可重复调用。
@@ -1206,33 +1247,47 @@ declare interface TRTCEventTypes {
1206
1247
  /**
1207
1248
  * 开启插件
1208
1249
  *
1209
- * 目前支持的插件:
1210
- *
1211
1250
  * | pluginName | 插件名称 | 参考教程 | 参数类型 |
1212
1251
  * | --- | --- | --- | --- |
1213
- * | 'AudioMixer' | 背景音乐插件 | {@tutorial 22-advanced-audio-mixer} | [AudioMixerOptions](./global.html#AudioMixerOptions) |
1214
- * | 'AIDenoiser' | 降噪插件 | {@tutorial 35-advanced-ai-denoiser} | [AIDenoiserOptions](./global.html#AIDenoiserOptions) |
1215
- * | 'CDNStreaming' | CDN混流插件 | {@tutorial 26-advanced-publish-cdn-stream} | [CDNStreamingOptions](./global.html#CDNStreamingOptions) |
1252
+ * | 'AudioMixer' | 背景音乐插件 | {@tutorial 22-advanced-audio-mixer} | [AudioMixerOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/global.html#AudioMixerOptions) |
1253
+ * | 'AIDenoiser' | 降噪插件 | {@tutorial 35-advanced-ai-denoiser} | [AIDenoiserOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/global.html#AIDenoiserOptions) |
1254
+ * | 'CDNStreaming' | CDN混流插件 | {@tutorial 26-advanced-publish-cdn-stream} | [CDNStreamingOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/global.html#CDNStreamingOptions) |
1216
1255
  *
1217
1256
  * @param {PluginName} plugin
1218
1257
  * @param {AudioMixerOptions|AIDenoiserOptions|CDNStreamingOptions} options
1219
- * @returns {Promise<any>}
1258
+ * @returns {Promise<void>}
1220
1259
  */
1221
- startPlugin(plugin: 'AudioMixer' | 'AIDenoiser' | 'CDNStreaming', options: any): Promise<void>;
1260
+ startPlugin<T extends keyof PluginStartOptionsMap, O extends PluginStartOptionsMap[T]>(plugin: O extends undefined ? never : T, options: O): Promise<any>;
1261
+ startPlugin<T extends keyof PluginStartOptionsMap, O extends PluginStartOptionsMap[T]>(plugin: O extends undefined ? T : never): Promise<any>;
1222
1262
  /**
1223
1263
  * 更新插件
1264
+ *
1265
+ * | pluginName | 插件名称 | 参考教程 | 参数类型 |
1266
+ * | --- | --- | --- | --- |
1267
+ * | 'AudioMixer' | 背景音乐插件 | {@tutorial 22-advanced-audio-mixer} | [UpdateAudioMixerOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/global.html#UpdateAudioMixerOptions) |
1268
+ * | 'CDNStreaming' | CDN混流插件 | {@tutorial 26-advanced-publish-cdn-stream} | [CDNStreamingOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/global.html#CDNStreamingOptions) |
1269
+ *
1224
1270
  * @param {PluginName} plugin
1225
1271
  * @param {UpdateAudioMixerOptions|CDNStreamingOptions} options
1226
- * @returns {Promise<any>}
1272
+ * @returns {Promise<void>}
1227
1273
  */
1228
- updatePlugin(plugin: 'AudioMixer' | 'CDNStreaming', options: any): Promise<void>;
1274
+ updatePlugin<T extends keyof PluginUpdateOptionsMap, O extends PluginUpdateOptionsMap[T]>(plugin: O extends undefined ? never : T, options: O): Promise<any>;
1275
+ updatePlugin<T extends keyof PluginUpdateOptionsMap, O extends PluginUpdateOptionsMap[T]>(plugin: O extends undefined ? T : never): Promise<any>;
1229
1276
  /**
1230
1277
  * 停止插件
1278
+ *
1279
+ * | pluginName | 插件名称 | 参考教程 | 参数类型 |
1280
+ * | --- | --- | --- | --- |
1281
+ * | 'AudioMixer' | 背景音乐插件 | {@tutorial 22-advanced-audio-mixer} | [StopAudioMixerOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/global.html#StopAudioMixerOptions) |
1282
+ * | 'AIDenoiser' | 降噪插件 | {@tutorial 35-advanced-ai-denoiser} | |
1283
+ * | 'CDNStreaming' | CDN混流插件 | {@tutorial 26-advanced-publish-cdn-stream} | [CDNStreamingOptions](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/global.html#CDNStreamingOptions) |
1284
+ *
1231
1285
  * @param {PluginName} plugin
1232
- * @param {StopAudioMixerOptions|CDNStreamingOptions} options
1233
- * @returns {Promise<any>}
1286
+ * @param {StopAudioMixerOptions|StopAIDenoiserOptions|CDNStreamingOptions} options
1287
+ * @returns {Promise<void>}
1234
1288
  */
1235
- stopPlugin(plugin: 'AudioMixer' | 'AIDenoiser' | 'CDNStreaming', options: any): Promise<void>;
1289
+ stopPlugin<T extends keyof PluginStopOptionsMap, O extends PluginStopOptionsMap[T]>(plugin: O extends undefined ? never : T, options: O): Promise<any>;
1290
+ stopPlugin<T extends keyof PluginStopOptionsMap, O extends PluginStopOptionsMap[T]>(plugin: O extends undefined ? T : never): Promise<any>;
1236
1291
  /**
1237
1292
  * 开启或关闭音量大小回调<br>
1238
1293
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-sdk-v5",
3
- "version": "5.1.1-beta.1",
3
+ "version": "5.1.1",
4
4
  "description": "Tencent Cloud RTC SDK for Web",
5
5
  "main": "trtc.js",
6
6
  "module": "trtc.esm.js",
@@ -1,10 +1,10 @@
1
- declare interface CDNStreamingOptions {
1
+ export declare interface CDNStreamingOptions {
2
2
  target: Target;
3
3
  encoding?: Encoding;
4
4
  mix?: Mix;
5
5
  }
6
6
 
7
- declare interface Target {
7
+ export declare interface Target {
8
8
  publishMode: PublishMode;
9
9
  streamId?: string;
10
10
  appId?: number;
@@ -12,7 +12,7 @@ declare interface Target {
12
12
  url?: string;
13
13
  }
14
14
 
15
- declare interface Encoding {
15
+ export declare interface Encoding {
16
16
  videoWidth?: number;
17
17
  videoHeight?: number;
18
18
  videoBitrate?: number;
@@ -23,20 +23,20 @@ declare interface Encoding {
23
23
  audioChannels?: 1 | 2;
24
24
  }
25
25
 
26
- declare interface Mix {
26
+ export declare interface Mix {
27
27
  backgroundColor?: number;
28
28
  backgroundImage?: string;
29
29
  audioMixUserList?: User[];
30
30
  videoLayoutList?: VideoLayout[];
31
31
  }
32
32
 
33
- declare interface User {
33
+ export declare interface User {
34
34
  userId: string;
35
35
  roomId: number;
36
36
  strRoomId: string;
37
37
  }
38
38
 
39
- declare interface VideoLayout {
39
+ export declare interface VideoLayout {
40
40
  fixedVideoUser: User;
41
41
  fixedVideoStreamType?: TRTCStreamType;
42
42
  fillMode?: 0 | 1 | 2;
@@ -47,18 +47,18 @@ declare interface VideoLayout {
47
47
  zOrder?: number;
48
48
  }
49
49
 
50
- declare enum TRTCStreamType {
50
+ export declare enum TRTCStreamType {
51
51
  Main = 'main',
52
52
  Sub = 'sub'
53
53
  }
54
54
 
55
- declare enum PublishMode {
55
+ export declare enum PublishMode {
56
56
  PublishMainStreamToCDN = 'PublishMainStreamToCDN',
57
57
  PublishSubStreamToCDN = 'PublishSubStreamToCDN',
58
58
  PublishMixStreamToCDN = 'PublishMixStreamToCDN'
59
59
  }
60
60
 
61
- declare class CDNStreaming {
61
+ export declare class CDNStreaming {
62
62
  static TYPE: {
63
63
  PublishMode: {
64
64
  PublishMainStreamToCDN: PublishMode.PublishMainStreamToCDN;
@@ -72,6 +72,5 @@ declare class CDNStreaming {
72
72
  stop(options: CDNStreamingOptions): Promise<void>;
73
73
  }
74
74
 
75
- export { PublishMode, TRTCStreamType };
76
75
  export { CDNStreaming };
77
76
  export default CDNStreaming;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/cdn-streaming",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "TRTC Web SDK 5.x CDN streaming plugin",
5
5
  "main": "./cdn-streaming.esm.js",
6
6
  "author": "longyuqi <longyuqi@tencent.com>",