quickvo-sdk-js 0.0.8 → 0.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.md +8 -7
- package/dist/QuickVO.d.ts +4 -169
- package/dist/enums/notifyName.d.ts +4 -3
- package/dist/enums/roomState.d.ts +17 -0
- package/dist/index.js +2152 -2011
- package/dist/index.umd.cjs +2 -2
- package/dist/{CallsWebSocket.d.ts → room/CallsWebSocket.d.ts} +4 -10
- package/dist/room/MediaStreams.d.ts +49 -0
- package/dist/room/Room.d.ts +12 -0
- package/dist/room/RoomAudio.d.ts +34 -0
- package/dist/room/RoomBase.d.ts +60 -0
- package/dist/room/RoomCalls.d.ts +85 -0
- package/dist/room/RoomPeer.d.ts +51 -0
- package/dist/room/RoomUsers.d.ts +61 -0
- package/dist/room/mediaStreamsContext/AudioMediaStreamContext.d.ts +43 -0
- package/dist/room/mediaStreamsContext/VideoMediaStreamContext.d.ts +12 -0
- package/dist/tools.d.ts +8 -10
- package/dist/types.d.ts +18 -36
- package/package.json +2 -2
- package/dist/MediaStreams.d.ts +0 -31
- package/dist/Room.d.ts +0 -125
package/README.md
CHANGED
|
@@ -235,14 +235,15 @@ quickvo.addNotify({
|
|
|
235
235
|
|
|
236
236
|
// 你可用在渲染每一个user时对 updateStreams进行监听 每一个user均包含字段 updateStreams 当用户流发送变化你需要重新获取流并渲染到界面
|
|
237
237
|
|
|
238
|
-
// 以第一个用户为例 我们发现他需要更新
|
|
238
|
+
// 以第一个用户为例 我们发现他需要更新 摄像头视频流
|
|
239
|
+
// 在 0.0.9版本之后,客户端无需再关心和处理音频媒体的播放了 SDK内部已经实现了处理
|
|
239
240
|
const [user] = users
|
|
240
241
|
const { id, updateStreams } = user
|
|
241
242
|
|
|
242
|
-
// 需要更新
|
|
243
|
-
if (updateStreams['
|
|
244
|
-
const stream = await quickvo.getUserStream(id, '
|
|
245
|
-
const dom =
|
|
243
|
+
// 需要更新 摄像头视频流
|
|
244
|
+
if (updateStreams['microphoneCamera_video']) {
|
|
245
|
+
const stream = await quickvo.getUserStream(id, 'microphoneCamera_video')
|
|
246
|
+
const dom = microphoneCamera_video_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
|
|
246
247
|
dom.srcObject = stream
|
|
247
248
|
|
|
248
249
|
// 下面的几行代码是非必须的 但是还是建议这样做 先暂停再播放 防止重复赋值播放带来的警告或异常错误
|
|
@@ -299,10 +300,10 @@ quickvo.setLocalStream('microphoneCamera_audio', true).then((streams) => {
|
|
|
299
300
|
/**
|
|
300
301
|
* 加入房间
|
|
301
302
|
* @param roomOptions RoomOptions
|
|
302
|
-
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' })
|
|
303
|
+
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1', autoSubscribe: true })
|
|
303
304
|
* @returns Promise<boolean>
|
|
304
305
|
*/
|
|
305
|
-
const options: RoomOptions = { userId: '', roomId: '', sdkToken: '', callType: '1' }
|
|
306
|
+
const options: RoomOptions = { userId: '', roomId: '', sdkToken: '', callType: '1', autoSubscribe: true }
|
|
306
307
|
quickvo.joinRoom(options)
|
|
307
308
|
```
|
|
308
309
|
|
package/dist/QuickVO.d.ts
CHANGED
|
@@ -1,117 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare class QuickVO {
|
|
1
|
+
import { Room } from './room/Room';
|
|
2
|
+
import { QuickOptions } from './types';
|
|
3
|
+
export declare class QuickVO extends Room {
|
|
5
4
|
#private;
|
|
6
|
-
constructor(options:
|
|
7
|
-
/**
|
|
8
|
-
* 设置本地流
|
|
9
|
-
* @param mediaType MediaType
|
|
10
|
-
* @param active 激活状态
|
|
11
|
-
* @example quickvo.setLocalStream('microphoneCamera_audio', false)
|
|
12
|
-
* @returns Promise<Streams>
|
|
13
|
-
*/
|
|
14
|
-
setLocalStream: (mediaType: K_mediaType, active: boolean) => Promise<Streams>;
|
|
15
|
-
/**
|
|
16
|
-
* 设置媒体参数
|
|
17
|
-
* @param mediaType MediaType
|
|
18
|
-
* @param constraints
|
|
19
|
-
* @example quickvo.setConstraints('microphoneCamera_video', { frameRate: { min: 10, ideal: frameRateIdeal } })
|
|
20
|
-
* @returns Promise<Streams>
|
|
21
|
-
*/
|
|
22
|
-
setConstraints: (mediaType: K_mediaType, constraints: MediaTrackConstraints) => Promise<MediaStream>;
|
|
23
|
-
/**
|
|
24
|
-
* 设置 RTCRtpSender 参数
|
|
25
|
-
* @param parameters RTCRtpSendParameters
|
|
26
|
-
*/
|
|
27
|
-
setRTCRtpSenderParameters: (parameters: RTCRtpSendParameters) => void;
|
|
28
|
-
/**
|
|
29
|
-
* 设置 通讯策略
|
|
30
|
-
* @param callStrategy "fixedPictureQuality" | "qualityPriority" | "fluencyPriority" | "balancedDowngrade"
|
|
31
|
-
* @example quickvo.setCallStrategy('fixedPictureQuality')
|
|
32
|
-
*/
|
|
33
|
-
setCallStrategy: (callStrategy: K_callStrategy) => void;
|
|
34
|
-
/**
|
|
35
|
-
* 销毁引擎
|
|
36
|
-
* @example quickvo.destroy()
|
|
37
|
-
*/
|
|
38
|
-
destroy: () => Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* 添加广播事件
|
|
41
|
-
* @param notify Notify
|
|
42
|
-
* @returns sn
|
|
43
|
-
*/
|
|
44
|
-
addNotify: (notify: Notify) => string;
|
|
45
|
-
/**
|
|
46
|
-
* 加入房间
|
|
47
|
-
* @param roomOptions RoomOptions
|
|
48
|
-
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1', autoSubscribe: true })
|
|
49
|
-
* @returns Promise<boolean>
|
|
50
|
-
*/
|
|
51
|
-
joinRoom: (roomOptions: RoomOptions) => Promise<RoomUser[]>;
|
|
52
|
-
/**
|
|
53
|
-
* 退出房间
|
|
54
|
-
* @example quickvo.quitRoom()
|
|
55
|
-
* @returns Promise<boolean>
|
|
56
|
-
*/
|
|
57
|
-
quitRoom: () => Promise<RoomUser[]>;
|
|
58
|
-
/**
|
|
59
|
-
* 同步房间信息
|
|
60
|
-
* @example quickvo.syncRoomInfo()
|
|
61
|
-
*/
|
|
62
|
-
syncRoomInfo: () => Promise<RoomUser[]>;
|
|
63
|
-
/**
|
|
64
|
-
* 发布流
|
|
65
|
-
* @param mediaTypes MediaType[]
|
|
66
|
-
* @param count 发布失败重试次数
|
|
67
|
-
* @example quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3)
|
|
68
|
-
* @returns Promise<RoomUser>
|
|
69
|
-
*/
|
|
70
|
-
publish: (mediaTypes: K_mediaType[], count?: number) => Promise<RoomUser>;
|
|
71
|
-
/**
|
|
72
|
-
* 停止发布流
|
|
73
|
-
* @param trackNames string[] = []
|
|
74
|
-
* @example quickvo.stopPublish(['microphoneCamera_audio'])
|
|
75
|
-
* @returns Promise<RoomUser>
|
|
76
|
-
*/
|
|
77
|
-
stopPublish: (mediaTypes?: K_mediaType[]) => Promise<RoomUser>;
|
|
78
|
-
/**
|
|
79
|
-
* 订阅流
|
|
80
|
-
* @param trackNames 轨道名称
|
|
81
|
-
* @param count 订阅失败重试次数
|
|
82
|
-
* @example quickvo.subscribe(['trackName1','trackName2'])
|
|
83
|
-
* @returns Promise<RoomUser[]>
|
|
84
|
-
*/
|
|
85
|
-
subscribe: (trackNames?: string[], count?: number) => Promise<RoomUser[]>;
|
|
86
|
-
/**
|
|
87
|
-
* 停止订阅流
|
|
88
|
-
* @param trackNames string[] = []
|
|
89
|
-
* @example quickvo.subscribe(['trackName1'])
|
|
90
|
-
*/
|
|
91
|
-
stopSubscribe: (trackNames?: string[]) => Promise<boolean>;
|
|
92
|
-
/**
|
|
93
|
-
* 获取某个用户完整数据
|
|
94
|
-
* @param userId string
|
|
95
|
-
* @example quickvo.getUserInfo('123')
|
|
96
|
-
* @returns Promise<RoomUser>
|
|
97
|
-
*/
|
|
98
|
-
getUserInfo: (userId: string) => Promise<RoomUser>;
|
|
99
|
-
/**
|
|
100
|
-
* 冻结轨道
|
|
101
|
-
* @param mediaTypes MediaType[] 轨道类型
|
|
102
|
-
* @param enabled 是否冻结
|
|
103
|
-
* @param userId 用户id
|
|
104
|
-
* @example quickvo.inactiveTracks(['microphoneCamera_audio'], false)
|
|
105
|
-
*/
|
|
106
|
-
inactiveTracks: (mediaTypes: K_mediaType[], enabled: boolean, userId?: string) => Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* 获取指定轨道的名称数组
|
|
109
|
-
* @param tracks 轨道
|
|
110
|
-
* @param types number[] = []
|
|
111
|
-
* @param keyName
|
|
112
|
-
* @returns string[]
|
|
113
|
-
*/
|
|
114
|
-
getTrackNamesFormTracks: (tracks: any[], types?: number[], keyName?: string) => string[];
|
|
5
|
+
constructor(options: QuickOptions);
|
|
115
6
|
/**
|
|
116
7
|
* 添加 FrameRequestCallback
|
|
117
8
|
* @param key string
|
|
@@ -123,60 +14,4 @@ export declare class QuickVO {
|
|
|
123
14
|
* @param keys string[] = []
|
|
124
15
|
*/
|
|
125
16
|
clearRequestAnimationFrame: (keys?: string[]) => Promise<number[]>;
|
|
126
|
-
/**
|
|
127
|
-
* 设置音量
|
|
128
|
-
* @param userId
|
|
129
|
-
* @param mediaType
|
|
130
|
-
*/
|
|
131
|
-
setVolume: (userId: string, mediaType: K_mediaType, gain: number) => void;
|
|
132
|
-
/**
|
|
133
|
-
* 获取声音大小
|
|
134
|
-
* @param userId
|
|
135
|
-
* @param mediaType
|
|
136
|
-
* @returns volume
|
|
137
|
-
*/
|
|
138
|
-
getVolume: (userId: string, mediaType: K_mediaType) => number;
|
|
139
|
-
/**
|
|
140
|
-
* 获取用户音频处理上下文
|
|
141
|
-
* @param userId
|
|
142
|
-
* @param mediaType
|
|
143
|
-
* @returns UserAudioContext | undefined
|
|
144
|
-
*/
|
|
145
|
-
getUserAudioContext: (userId: string, mediaType: K_mediaType) => import('./types').UserAudioContext | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* 获取当前最大音量用户
|
|
148
|
-
*/
|
|
149
|
-
getMaxVolumeUser: () => {
|
|
150
|
-
id: string;
|
|
151
|
-
volume: number;
|
|
152
|
-
} | undefined;
|
|
153
|
-
/**
|
|
154
|
-
* 获取网络情况
|
|
155
|
-
*/
|
|
156
|
-
getPeerNetwork: () => {
|
|
157
|
-
lostRate: string;
|
|
158
|
-
roundTripTime: string;
|
|
159
|
-
jitter: string;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* 获取某个用户的某个数据流
|
|
163
|
-
* @param userId 用户ID
|
|
164
|
-
* @param mediaType 媒体类型
|
|
165
|
-
* @returns Promise<MediaStream>
|
|
166
|
-
*/
|
|
167
|
-
getUserStream: (userId: string, mediaType: K_mediaType) => Promise<MediaStream>;
|
|
168
|
-
/**
|
|
169
|
-
* 获取某个用户的全部数据流
|
|
170
|
-
* @param userId 用户ID
|
|
171
|
-
* @returns Promise<Streams>
|
|
172
|
-
*/
|
|
173
|
-
getUserStreams: (userId: string) => Promise<Streams>;
|
|
174
|
-
/**
|
|
175
|
-
* 设置音频过滤
|
|
176
|
-
*/
|
|
177
|
-
setAudioFilter: (options?: Partial<UserAudioFilterOptions>) => Promise<void>;
|
|
178
|
-
/**
|
|
179
|
-
* 远端调试
|
|
180
|
-
*/
|
|
181
|
-
debugger: () => Promise<any>;
|
|
182
17
|
}
|
|
@@ -4,16 +4,17 @@ export declare const enum_notifyName: {
|
|
|
4
4
|
readonly healthCheck: "心跳检测";
|
|
5
5
|
readonly onNetQuality: "网络质量回调";
|
|
6
6
|
readonly onLogin: "登录回调";
|
|
7
|
+
readonly onLocalStream: "更新本地媒体流";
|
|
7
8
|
readonly onRoomUsers: "房间用户变化";
|
|
9
|
+
readonly onRoomState: "房间状态变化";
|
|
8
10
|
readonly onJoinRoom: "加入房间回调";
|
|
9
11
|
readonly onQuitRoom: "退出房间回调";
|
|
10
12
|
readonly onPublish: "监听到流发布";
|
|
11
13
|
readonly onCloseTrack: "关闭轨道";
|
|
12
14
|
readonly onUpdateCall: "更新通讯状态";
|
|
13
|
-
readonly onLocalStream: "更新本地媒体流";
|
|
14
|
-
readonly onIceDisconnected: "ice断开";
|
|
15
15
|
readonly onTokenExpired: "Token已过期";
|
|
16
16
|
readonly destroyRoom: "销毁房间";
|
|
17
|
+
readonly onDestroy: "销毁";
|
|
17
18
|
};
|
|
18
19
|
export type T_notifyName = typeof enum_notifyName;
|
|
19
20
|
export type K_notifyName = keyof T_notifyName;
|
|
@@ -23,4 +24,4 @@ export declare const notifyName_options: {
|
|
|
23
24
|
label: any;
|
|
24
25
|
}[];
|
|
25
26
|
export declare const notifyName_keys: (keyof typeof enum_notifyName)[];
|
|
26
|
-
export declare const notifyName_vals: ("关闭轨道" | "网络情况变更" | "房间网络情况变更" | "心跳检测" | "网络质量回调" | "登录回调" | "
|
|
27
|
+
export declare const notifyName_vals: ("关闭轨道" | "网络情况变更" | "房间网络情况变更" | "心跳检测" | "网络质量回调" | "登录回调" | "更新本地媒体流" | "房间用户变化" | "房间状态变化" | "加入房间回调" | "退出房间回调" | "监听到流发布" | "更新通讯状态" | "Token已过期" | "销毁房间" | "销毁")[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const enum_roomState: {
|
|
2
|
+
readonly ready: "已就绪";
|
|
3
|
+
readonly checkAuth: "正在鉴权";
|
|
4
|
+
readonly connect: "连接中";
|
|
5
|
+
readonly connected: "已连接";
|
|
6
|
+
readonly reconnect: "正在重新连接";
|
|
7
|
+
readonly disconnected: "已断开";
|
|
8
|
+
};
|
|
9
|
+
export type T_roomState = typeof enum_roomState;
|
|
10
|
+
export type K_roomState = keyof T_roomState;
|
|
11
|
+
export type V_roomState = T_roomState[K_roomState];
|
|
12
|
+
export declare const roomState_options: {
|
|
13
|
+
value: any;
|
|
14
|
+
label: any;
|
|
15
|
+
}[];
|
|
16
|
+
export declare const roomState_keys: (keyof typeof enum_roomState)[];
|
|
17
|
+
export declare const roomState_vals: ("已就绪" | "正在鉴权" | "连接中" | "已连接" | "正在重新连接" | "已断开")[];
|