trtc-sdk-v5 5.1.0-beta.3 → 5.1.0
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/README-zh_CN.md +1 -0
- package/README.md +2 -1
- package/index.d.ts +66 -24
- package/package.json +7 -1
- package/plugins/ai-denoiser/denoiser-wasm.js +17 -0
- package/plugins/cdn-streaming/cdn-streaming.esm.d.ts +77 -0
- package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -0
- package/plugins/cdn-streaming/cdn-streaming.iife.js +1 -0
- package/plugins/cdn-streaming/package.json +31 -0
- package/trtc.esm.js +21 -94
- package/trtc.js +1 -1
package/README-zh_CN.md
CHANGED
package/README.md
CHANGED
|
@@ -77,7 +77,8 @@ Explore SDK documents:[TRTC Web SDK](https://web.sdk.qcloud.com/trtc/webrtc/v5
|
|
|
77
77
|
├── package.json
|
|
78
78
|
├── trtc.js // sdk file(umd format)
|
|
79
79
|
├── trtc.esm.js // sdk file base on ES modules(esm format)
|
|
80
|
-
|
|
80
|
+
├── index.d.ts // ts declaration file
|
|
81
|
+
└── plugins // trtc plugins
|
|
81
82
|
```
|
|
82
83
|
|
|
83
84
|
## Changelog
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference path="./core.d.ts" />
|
|
2
2
|
|
|
3
|
+
declare interface TRTCOptions {
|
|
4
|
+
plugins?: Array<{
|
|
5
|
+
new (core: Core): IPlugin;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
3
8
|
declare interface LocalVideoConfig {
|
|
4
9
|
view?: string | HTMLElement | HTMLElement[] | null;
|
|
5
10
|
publish?: boolean;
|
|
@@ -28,7 +33,8 @@
|
|
|
28
33
|
sdkAppId: number;
|
|
29
34
|
userId: string;
|
|
30
35
|
userSig: string;
|
|
31
|
-
roomId
|
|
36
|
+
roomId?: number;
|
|
37
|
+
strRoomId?: string;
|
|
32
38
|
role?: UserRole;
|
|
33
39
|
autoReceiveAudio?: boolean;
|
|
34
40
|
autoReceiveVideo?: boolean;
|
|
@@ -37,7 +43,6 @@
|
|
|
37
43
|
enableAutoPlayDialog?: boolean;
|
|
38
44
|
proxy?: ProxyServer | string;
|
|
39
45
|
scene?: Scene;
|
|
40
|
-
streamId?: string;
|
|
41
46
|
userDefineRecordId?: string;
|
|
42
47
|
}
|
|
43
48
|
declare interface ScreenShareConfig {
|
|
@@ -110,15 +115,6 @@
|
|
|
110
115
|
Main = "main",
|
|
111
116
|
Sub = "sub"
|
|
112
117
|
}
|
|
113
|
-
declare interface TRTCMixUser extends Omit<MixUser, 'streamType'> {
|
|
114
|
-
streamType?: TRTCStreamType;
|
|
115
|
-
}
|
|
116
|
-
declare interface TRTCMixTranscodeConfig extends Omit<MixTranscodeConfig, 'mixUsers'> {
|
|
117
|
-
mixUsers: TRTCMixUser[];
|
|
118
|
-
}
|
|
119
|
-
declare interface TRTCPublishCDNParam extends Omit<PublishCDNStreamOptions, 'streamType'> {
|
|
120
|
-
streamType?: TRTCStreamType;
|
|
121
|
-
}
|
|
122
118
|
declare enum TRTCDeviceType {
|
|
123
119
|
Camera = "camera",
|
|
124
120
|
Microphone = "microphone",
|
|
@@ -309,7 +305,12 @@
|
|
|
309
305
|
*/
|
|
310
306
|
readonly AUTOPLAY_FAILED: "autoplay-failed";
|
|
311
307
|
/**
|
|
312
|
-
*
|
|
308
|
+
* 被踢出房间,原因如下:<br/>
|
|
309
|
+
* - kick: 相同 userId 的用户同时进入同一个房间(以下简称为同名进房),先进入房间的用户会被后进入的用户踢出房间。<br>
|
|
310
|
+
* - 同名进房是不允许的行为,可能会导致双方音视频通话异常,业务侧应避免出现这种情况。
|
|
311
|
+
* - TRTC 后台不保证观众角色同名进房互踢。即观众角色的用户,使用同 userId 进同一个房间,可能不会收到该事件。
|
|
312
|
+
* - banned: 系统管理员通过{@link https://cloud.tencent.com/document/product/647/40496 服务端 API} 将该用户踢出房间。
|
|
313
|
+
* - room-disband: 系统管理员通过{@link https://cloud.tencent.com/document/product/647/40496 服务端 API} 解散房间。
|
|
313
314
|
* @default 'kicked-out'
|
|
314
315
|
* @memberof module:EVENT
|
|
315
316
|
* @example
|
|
@@ -600,6 +601,17 @@
|
|
|
600
601
|
* });
|
|
601
602
|
*/
|
|
602
603
|
readonly PUBLISH_STATE_CHANGED: "publish-state-changed";
|
|
604
|
+
/**
|
|
605
|
+
* @private
|
|
606
|
+
* @description 收到 SEI message<br>
|
|
607
|
+
* @default 'sei-message'
|
|
608
|
+
* @memberof module:EVENT
|
|
609
|
+
* @example
|
|
610
|
+
* trtc.on(TRTC.EVENT.SEI_MESSAGE, event => {
|
|
611
|
+
* console.log(`收到 ${event.userId} 的 sei message: ${event.data}`)
|
|
612
|
+
* })
|
|
613
|
+
*/
|
|
614
|
+
readonly SEI_MESSAGE: "sei-message";
|
|
603
615
|
};
|
|
604
616
|
declare interface TRTCEventTypes {
|
|
605
617
|
[TRTCEvent.ERROR]: [RtcError];
|
|
@@ -664,6 +676,10 @@
|
|
|
664
676
|
error?: RtcError;
|
|
665
677
|
}
|
|
666
678
|
];
|
|
679
|
+
[TRTCEvent.SEI_MESSAGE]: [{
|
|
680
|
+
data: Uint8Array;
|
|
681
|
+
userId: string;
|
|
682
|
+
}];
|
|
667
683
|
}
|
|
668
684
|
class TRTC extends EventEmitter<TRTCEventTypes> {
|
|
669
685
|
/**
|
|
@@ -677,7 +693,7 @@
|
|
|
677
693
|
*
|
|
678
694
|
* @returns {TRTC} trtc对象
|
|
679
695
|
*/
|
|
680
|
-
static create(): TRTC;
|
|
696
|
+
static create(options?: TRTCOptions): TRTC;
|
|
681
697
|
/**
|
|
682
698
|
* @typedef TurnServer
|
|
683
699
|
* @property {string} url TURN 服务器 url
|
|
@@ -707,15 +723,17 @@
|
|
|
707
723
|
* 建议限制长度为32字节,只允许包含大小写英文字母(a-zA-Z)、数字(0-9)及下划线和连词符。
|
|
708
724
|
* @param {string} options.userSig userSig 签名 <br>
|
|
709
725
|
* 计算 userSig 的方式请参考 [UserSig 相关](https://cloud.tencent.com/document/product/647/17275)。
|
|
710
|
-
* @param {number
|
|
711
|
-
*
|
|
712
|
-
* roomId
|
|
726
|
+
* @param {number=} options.roomId
|
|
727
|
+
* 数字类型的房间号,取值要求为 [1, 4294967294] 的整数;<br>
|
|
728
|
+
* <font color="red">如果需要使用字符串类型的房间号请使用 strRoomId 参数,roomId 和 strRoomId 必须填一个。若两者都填,则优先选择 roomId。</font>
|
|
729
|
+
* @param {string=} options.strRoomId
|
|
730
|
+
* 字符串类型的房间号,限制长度为64字节,且仅支持以下范围的字符集:
|
|
713
731
|
* - 大小写英文字母(a-zA-Z)
|
|
714
732
|
* - 数字(0-9)
|
|
715
733
|
* - 空格 ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
|
|
716
734
|
*
|
|
717
735
|
* <font color="red">注意:建议采用数字类型的 roomId,字符串类型的房间号 "123" 与 数字类型的房间号 123 不互通。</font>
|
|
718
|
-
|
|
736
|
+
* @param {string} [options.scene] 应用场景,目前支持以下两种场景:
|
|
719
737
|
* - {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC}(默认)实时通话场景,该模式适合 1对1 的音视频通话,或者参会人数在 300 人以内的在线会议。[支持最大50人同时开麦](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/tutorial-04-info-uplink-limits.html)。
|
|
720
738
|
* - {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} 互动直播场景,该模式适合十万人以内的在线直播场景,但需要您在接下来介绍的 options 参数中指定 角色(role) 这个字段
|
|
721
739
|
* @param {string=} [options.role] 用户角色,仅在 {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} 场景下有意义,{@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} 场景无需指定 role,目前支持两种角色:
|
|
@@ -729,9 +747,6 @@
|
|
|
729
747
|
* @param {boolean} [options.enableAutoPlayDialog] 是否开启 SDK 自动播放失败弹窗,默认:true。
|
|
730
748
|
* - 默认开启,当出现自动播放失败时,SDK 会弹窗引导用户点击页面,来恢复音视频播放。
|
|
731
749
|
* - 可设置为 false 关闭,建议接入侧参考 [自动播放受限处理建议](https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-21-advanced-auto-play-policy.html) 来处理自动播放失败相关问题。
|
|
732
|
-
* @param {string=} options.streamId 用于设置在腾讯云直播平台上的 streamId(选填)。
|
|
733
|
-
* - 【推荐取值】限制长度为64字节,可以不填写。一种推荐的方案是使用 sdkappid_roomid_userid_main 作为 streamid,这种命名方式容易辨认且不会在您的多个应用中发生冲突。
|
|
734
|
-
* - 【参考文档】[CDN 旁路直播](https://cloud.tencent.com/document/product/647/16826)。
|
|
735
750
|
* @param {string=} options.userDefineRecordId 用于设置云端录制的 userDefineRecordId(选填)。
|
|
736
751
|
* - 【推荐取值】限制长度为64字节,只允许包含大小写英文字母(a-zA-Z)、数字(0-9)及下划线和连词符。
|
|
737
752
|
* - 【参考文档】[云端录制](https://cloud.tencent.com/document/product/647/16823)。
|
|
@@ -1088,10 +1103,6 @@
|
|
|
1088
1103
|
* await trtc.stopScreenShare();
|
|
1089
1104
|
* */
|
|
1090
1105
|
stopScreenShare(): Promise<void>;
|
|
1091
|
-
usePlugin(): void;
|
|
1092
|
-
startPlugin(name: string, options: AudioSourceOptions): Promise<void>;
|
|
1093
|
-
updatePlugin(name: string, option: any): void;
|
|
1094
|
-
stopPlugin(name: string, options: any): Promise<void>;
|
|
1095
1106
|
/**
|
|
1096
1107
|
* 播放远端视频
|
|
1097
1108
|
*
|
|
@@ -1192,6 +1203,36 @@
|
|
|
1192
1203
|
* await trtc.setRemoteAudioVolume('123', 90);
|
|
1193
1204
|
* */
|
|
1194
1205
|
setRemoteAudioVolume(userId: string, volume: number): void;
|
|
1206
|
+
/**
|
|
1207
|
+
* 开启插件
|
|
1208
|
+
*
|
|
1209
|
+
* 目前支持的插件:
|
|
1210
|
+
*
|
|
1211
|
+
* | pluginName | 插件名称 | 参考教程 | 参数类型 |
|
|
1212
|
+
* | --- | --- | --- | --- |
|
|
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) |
|
|
1216
|
+
*
|
|
1217
|
+
* @param {PluginName} plugin
|
|
1218
|
+
* @param {AudioMixerOptions|AIDenoiserOptions|CDNStreamingOptions} options
|
|
1219
|
+
* @returns {Promise<any>}
|
|
1220
|
+
*/
|
|
1221
|
+
startPlugin(plugin: 'AudioMixer' | 'AIDenoiser' | 'CDNStreaming', options: any): Promise<void>;
|
|
1222
|
+
/**
|
|
1223
|
+
* 更新插件
|
|
1224
|
+
* @param {PluginName} plugin
|
|
1225
|
+
* @param {UpdateAudioMixerOptions|CDNStreamingOptions} options
|
|
1226
|
+
* @returns {Promise<any>}
|
|
1227
|
+
*/
|
|
1228
|
+
updatePlugin(plugin: 'AudioMixer' | 'CDNStreaming', options: any): Promise<void>;
|
|
1229
|
+
/**
|
|
1230
|
+
* 停止插件
|
|
1231
|
+
* @param {PluginName} plugin
|
|
1232
|
+
* @param {StopAudioMixerOptions|CDNStreamingOptions} options
|
|
1233
|
+
* @returns {Promise<any>}
|
|
1234
|
+
*/
|
|
1235
|
+
stopPlugin(plugin: 'AudioMixer' | 'AIDenoiser' | 'CDNStreaming', options: any): Promise<void>;
|
|
1195
1236
|
/**
|
|
1196
1237
|
* 开启或关闭音量大小回调<br>
|
|
1197
1238
|
*
|
|
@@ -1303,6 +1344,7 @@
|
|
|
1303
1344
|
readonly SCREEN_SHARE_STOPPED: "screen-share-stopped";
|
|
1304
1345
|
readonly DEVICE_CHANGED: "device-changed";
|
|
1305
1346
|
readonly PUBLISH_STATE_CHANGED: "publish-state-changed";
|
|
1347
|
+
readonly SEI_MESSAGE: "sei-message";
|
|
1306
1348
|
};
|
|
1307
1349
|
static ERROR_CODE: {
|
|
1308
1350
|
INVALID_PARAMETER: number;
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-sdk-v5",
|
|
3
|
-
"version": "5.1.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Tencent Cloud RTC SDK for Web",
|
|
5
5
|
"main": "trtc.js",
|
|
6
6
|
"module": "trtc.esm.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"afsm": "2.4.1",
|
|
10
|
+
"eventemitter3": "^4.0.7",
|
|
11
|
+
"sdp-transform": "^2.8.0",
|
|
12
|
+
"webrtc-adapter": "^8.2.3"
|
|
13
|
+
},
|
|
8
14
|
"keywords": [
|
|
9
15
|
"webrtc",
|
|
10
16
|
"TRTC",
|