trtc-sdk-v5 5.1.0-beta.4 → 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 +50 -20
- 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 -95
- 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
|
|
@@ -692,7 +693,7 @@
|
|
|
692
693
|
*
|
|
693
694
|
* @returns {TRTC} trtc对象
|
|
694
695
|
*/
|
|
695
|
-
static create(): TRTC;
|
|
696
|
+
static create(options?: TRTCOptions): TRTC;
|
|
696
697
|
/**
|
|
697
698
|
* @typedef TurnServer
|
|
698
699
|
* @property {string} url TURN 服务器 url
|
|
@@ -722,15 +723,17 @@
|
|
|
722
723
|
* 建议限制长度为32字节,只允许包含大小写英文字母(a-zA-Z)、数字(0-9)及下划线和连词符。
|
|
723
724
|
* @param {string} options.userSig userSig 签名 <br>
|
|
724
725
|
* 计算 userSig 的方式请参考 [UserSig 相关](https://cloud.tencent.com/document/product/647/17275)。
|
|
725
|
-
* @param {number
|
|
726
|
-
*
|
|
727
|
-
* 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字节,且仅支持以下范围的字符集:
|
|
728
731
|
* - 大小写英文字母(a-zA-Z)
|
|
729
732
|
* - 数字(0-9)
|
|
730
733
|
* - 空格 ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
|
|
731
734
|
*
|
|
732
735
|
* <font color="red">注意:建议采用数字类型的 roomId,字符串类型的房间号 "123" 与 数字类型的房间号 123 不互通。</font>
|
|
733
|
-
|
|
736
|
+
* @param {string} [options.scene] 应用场景,目前支持以下两种场景:
|
|
734
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)。
|
|
735
738
|
* - {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} 互动直播场景,该模式适合十万人以内的在线直播场景,但需要您在接下来介绍的 options 参数中指定 角色(role) 这个字段
|
|
736
739
|
* @param {string=} [options.role] 用户角色,仅在 {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} 场景下有意义,{@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} 场景无需指定 role,目前支持两种角色:
|
|
@@ -744,9 +747,6 @@
|
|
|
744
747
|
* @param {boolean} [options.enableAutoPlayDialog] 是否开启 SDK 自动播放失败弹窗,默认:true。
|
|
745
748
|
* - 默认开启,当出现自动播放失败时,SDK 会弹窗引导用户点击页面,来恢复音视频播放。
|
|
746
749
|
* - 可设置为 false 关闭,建议接入侧参考 [自动播放受限处理建议](https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-21-advanced-auto-play-policy.html) 来处理自动播放失败相关问题。
|
|
747
|
-
* @param {string=} options.streamId 用于设置在腾讯云直播平台上的 streamId(选填)。
|
|
748
|
-
* - 【推荐取值】限制长度为64字节,可以不填写。一种推荐的方案是使用 sdkappid_roomid_userid_main 作为 streamid,这种命名方式容易辨认且不会在您的多个应用中发生冲突。
|
|
749
|
-
* - 【参考文档】[CDN 旁路直播](https://cloud.tencent.com/document/product/647/16826)。
|
|
750
750
|
* @param {string=} options.userDefineRecordId 用于设置云端录制的 userDefineRecordId(选填)。
|
|
751
751
|
* - 【推荐取值】限制长度为64字节,只允许包含大小写英文字母(a-zA-Z)、数字(0-9)及下划线和连词符。
|
|
752
752
|
* - 【参考文档】[云端录制](https://cloud.tencent.com/document/product/647/16823)。
|
|
@@ -1203,6 +1203,36 @@
|
|
|
1203
1203
|
* await trtc.setRemoteAudioVolume('123', 90);
|
|
1204
1204
|
* */
|
|
1205
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>;
|
|
1206
1236
|
/**
|
|
1207
1237
|
* 开启或关闭音量大小回调<br>
|
|
1208
1238
|
*
|
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",
|