quickvo-sdk-js 1.6.8 → 1.6.10

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 CHANGED
@@ -30,10 +30,10 @@
30
30
 
31
31
  ```ts
32
32
  type T_mediaType = {
33
- readonly microphoneCamera_audio: '麦克风-默认轨道'
34
- readonly microphoneCamera_video: '摄像头-默认轨道'
35
- readonly screenSharing_video: '屏幕共享-视频轨道'
36
- readonly screenSharing_audio: '屏幕共享-音频轨道'
33
+ readonly mc_audio: '麦克风-默认轨道'
34
+ readonly mc_video: '摄像头-默认轨道'
35
+ readonly ss_video: '屏幕共享-视频轨道'
36
+ readonly ss_audio: '屏幕共享-音频轨道'
37
37
  }
38
38
  type K_mediaType = keyof T_mediaType
39
39
  ```
@@ -216,11 +216,11 @@ export const quickvo = new QuickVO({ appid: 'A6B499768801DJT8ACA11E5F842DB6DF' }
216
216
 
217
217
  ```vue
218
218
  <template>
219
- <video ref="microphoneCamera_audio_ref"></video>
219
+ <video ref="mc_audio_ref"></video>
220
220
  </template>
221
221
 
222
222
  <script setup lang="ts">
223
- const microphoneCamera_audio_ref = ref<HTMLVideoElement>()
223
+ const mc_audio_ref = ref<HTMLVideoElement>()
224
224
  </script>
225
225
  ```
226
226
 
@@ -239,9 +239,9 @@ quickvo.addNotify({
239
239
  const { id, updateStreams } = user
240
240
 
241
241
  // 需要更新 麦克风
242
- if (updateStreams['microphoneCamera_audio']) {
243
- const stream = await quickvo.getUserStream(id, 'microphoneCamera_audio')
244
- const dom = microphoneCamera_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
242
+ if (updateStreams['mc_audio']) {
243
+ const stream = await quickvo.getUserStream(id, 'mc_audio')
244
+ const dom = mc_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
245
245
  dom.srcObject = stream
246
246
 
247
247
  // 下面的几行代码是非必须的 但是还是建议这样做 先暂停再播放 防止重复赋值播放带来的警告或异常错误
@@ -252,13 +252,13 @@ quickvo.addNotify({
252
252
  }
253
253
  }
254
254
 
255
- if (updateStreams['microphoneCamera_video']) {
255
+ if (updateStreams['mc_video']) {
256
256
  // ...
257
257
  }
258
- if (updateStreams['screenSharing_audio']) {
258
+ if (updateStreams['ss_audio']) {
259
259
  // ...
260
260
  }
261
- if (updateStreams['screenSharing_video']) {
261
+ if (updateStreams['ss_video']) {
262
262
  // ...
263
263
  }
264
264
  }
@@ -269,22 +269,22 @@ quickvo.addNotify({
269
269
 
270
270
  - 通常如果应用层需要实现本地预览麦克风、摄像头等待发布的媒体流时,你可以尝试调用该 api,目前支持开启以下四种类型:
271
271
 
272
- 1. 麦克风 microphoneCamera_audio
273
- 2. 摄像头 microphoneCamera_video
274
- 3. 屏幕音频 screenSharing_audio (由于浏览器内部机制,不能单独选择该媒体,因此在选择屏幕音频时,直接设置共享屏幕音视频)
275
- 4. 屏幕视频 screenSharing_video (如果你需要单独共享屏幕画面 而不共享屏幕音频才考虑选择该类型,更多的建议直接开启 screenSharing_audio 然后主动控制流媒体的发布、暂停)
272
+ 1. 麦克风 mc_audio
273
+ 2. 摄像头 mc_video
274
+ 3. 屏幕音频 ss_audio (由于浏览器内部机制,不能单独选择该媒体,因此在选择屏幕音频时,直接设置共享屏幕音视频)
275
+ 4. 屏幕视频 ss_video (如果你需要单独共享屏幕画面 而不共享屏幕音频才考虑选择该类型,更多的建议直接开启 ss_audio 然后主动控制流媒体的发布、暂停)
276
276
 
277
277
  ```ts
278
278
  /**
279
279
  * 设置本地流
280
280
  * @param mediaType MediaType
281
281
  * @param active 激活状态
282
- * @example quickvo.setLocalStream(['microphoneCamera_audio'], false)
282
+ * @example quickvo.setLocalStream(['mc_audio'], false)
283
283
  * @returns Promise<Streams>
284
284
  */
285
- quickvo.setLocalStream(['microphoneCamera_audio'], true).then((streams) => {
285
+ quickvo.setLocalStream(['mc_audio'], true).then((streams) => {
286
286
  // 因考虑到易用性(与 onLocalStream 保持一致) 这里会返回所有本地流对象
287
- const stream = streams['microphoneCamera_audio']
287
+ const stream = streams['mc_audio']
288
288
  // 拿到所需要的 stream 然后进行渲染 (这里以原生js使用方式作为参考)
289
289
  document.querySelector<HTMLVideoElement>('#my-dom-view')?.srcObject = stream
290
290
  })
@@ -314,15 +314,15 @@ quickvo.joinRoom(options)
314
314
  * 发布流
315
315
  * @param mediaTypes MediaType[]
316
316
  * @param count 发布失败重试次数
317
- * @example quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3)
317
+ * @example quickvo.publish(['mc_audio', 'mc_video'], 3)
318
318
  * @returns Promise<RoomUser>
319
319
  */
320
- quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3).then((user) => {
320
+ quickvo.publish(['mc_audio', 'mc_video'], 3).then((user) => {
321
321
  const { id, updateStreams } = user
322
322
  // 需要更新 麦克风
323
- if (updateStreams['microphoneCamera_audio']) {
324
- const stream = await quickvo.getUserStream(id, 'microphoneCamera_audio')
325
- const dom = microphoneCamera_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
323
+ if (updateStreams['mc_audio']) {
324
+ const stream = await quickvo.getUserStream(id, 'mc_audio')
325
+ const dom = mc_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
326
326
  dom.srcObject = stream
327
327
  }
328
328
  })
@@ -344,9 +344,9 @@ quickvo.subscribe(['123']).then((users) => {
344
344
  for (const user of users) {
345
345
  const { id, updateStreams } = user
346
346
  // 需要更新 麦克风
347
- if (updateStreams['microphoneCamera_audio']) {
348
- const stream = await quickvo.getUserStream(id, 'microphoneCamera_audio')
349
- const dom = microphoneCamera_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
347
+ if (updateStreams['mc_audio']) {
348
+ const stream = await quickvo.getUserStream(id, 'mc_audio')
349
+ const dom = mc_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
350
350
  dom.srcObject = stream
351
351
  }
352
352
  }
@@ -409,6 +409,37 @@ quickvo.quitRoom()
409
409
 
410
410
  ### 版本迭代说明
411
411
 
412
+ - 版本:1.6.0 (2026-01-28)
413
+
414
+ #### api名称变更
415
+
416
+ ```
417
+ setSpeaker => setSpeakerVolume
418
+ setVolume => setInputVolume
419
+ ```
420
+
421
+ #### 枚举变更
422
+
423
+ ```ts
424
+ export const enum_mediaType = {
425
+ ['mc_audio']: '麦克风-默认轨道',
426
+ ['mc_video']: '摄像头-默认轨道',
427
+
428
+ ['ss_video']: '屏幕共享-视频轨道',
429
+ ['ss_audio']: '屏幕共享-音频轨道'
430
+ } as const
431
+ ```
432
+
433
+ #### 视频渲染变更
434
+
435
+ - 现在视频流不需要重新渲染 当sdk内部通知有该用户开启即可获取该用户视频流。
436
+
437
+ ```ts
438
+ const stream = quickvo.getUserStream(props.userInfo.id, 'mc_video')
439
+ video_dom.srcObject = stream
440
+ video_dom.play()
441
+ ```
442
+
412
443
  - 版本:1.5.0 (2025-11-19)
413
444
 
414
445
  ```
@@ -421,8 +452,8 @@ quickvo.quitRoom()
421
452
 
422
453
  以下是升级指南:
423
454
  在任何调用 inactiveTracks 的地方 全部修改为 pauseTracks。( 注意:第二个参数 boolean 相反 前者描述的是启用什么轨道 后者描述的是暂停什么轨道 )
424
- 如 quickvo.inactiveTracks(['microphoneCamera_video'], false) // 冻结视频轨道
425
- 修改为 quickvo.pauseTracks。(['microphoneCamera_video'], true) // 暂停视频轨道
455
+ 如 quickvo.inactiveTracks(['mc_video'], false) // 冻结视频轨道
456
+ 修改为 quickvo.pauseTracks。(['mc_video'], true) // 暂停视频轨道
426
457
 
427
458
 
428
459
  ```
@@ -440,18 +471,18 @@ quickvo.quitRoom()
440
471
  由原来的
441
472
  quickvo.subscribe(['trackName1','trackName2'])
442
473
  调整为
443
- quickvo.subscribe([{ userId: '123', mediaTypes: ['microphoneCamera_audio', 'microphoneCamera_video'] }])
474
+ quickvo.subscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
444
475
 
445
476
  由原来的
446
477
  quickvo.stopSubscribe(['trackName1','trackName2'])
447
478
  调整为
448
- quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['microphoneCamera_audio', 'microphoneCamera_video'] }])
479
+ quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
449
480
 
450
481
  SDK内部提供了方便开发者升级的api:
451
482
  /**
452
483
  * getUsersMediaTypeBytrackNames
453
484
  * @param trackNames string[]
454
- * @returns [{ userId: '123', mediaTypes: ['mediaTypes', 'microphoneCamera_video'] }]
485
+ * @returns [{ userId: '123', mediaTypes: ['mediaTypes', 'mc_video'] }]
455
486
  */
456
487
 
457
488
  const usersMediaType = quickvo.getUsersMediaTypeBytrackNames(['trackName1','trackName2'])
package/dist/QuickVO.d.ts CHANGED
@@ -14,40 +14,40 @@ export declare class QuickVO {
14
14
  callback?: (e: any) => void;
15
15
  }) => string;
16
16
  setOptions: (options: Partial<QuickOptions & import('./types').RoomOptions>) => void;
17
- getLocalStream: (mediaType: import('./enums/mediaType').K_mediaType) => MediaStream;
17
+ getLocalStream: (mediaType: import('./enums').K_mediaType) => MediaStream;
18
18
  getLocalStreams: () => {
19
19
  mc_audio: MediaStream;
20
20
  mc_video: MediaStream;
21
21
  ss_video: MediaStream;
22
22
  ss_audio: MediaStream;
23
23
  };
24
- setActiveNoise: (mediaType: import('./enums/mediaType').K_mediaType, state: boolean) => void;
24
+ setActiveNoise: (mediaType: import('./enums').K_mediaType, state: boolean) => void;
25
25
  getUserContent: (userId?: string) => import('./base/modules/users/modules/LocalUser').LocalUser | import('./base/modules/users/modules/RemoteUser').RemoteUser | undefined;
26
- getUserStream: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => MediaStream | undefined;
27
- getVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => number | undefined;
26
+ getUserStream: (userId: string, mediaType: import('./enums').K_mediaType) => MediaStream | undefined;
27
+ getVolume: (userId: string, mediaType: import('./enums').K_mediaType) => number | undefined;
28
28
  getMaxVolumeUser: () => {
29
29
  id: string;
30
30
  volume: number;
31
31
  } | undefined;
32
- setInputVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => void;
33
- setEnhanceGain: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => Promise<void>;
34
- setSpeakerVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => void;
35
- getUserAudioMediaStreamContext: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => import('pr-audio-stream').PrAudioStream | undefined;
32
+ setInputVolume: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => void;
33
+ setEnhanceGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
34
+ setSpeakerVolume: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => void;
35
+ getUserAudioMediaStreamContext: (userId: string, mediaType: import('./enums').K_mediaType) => import('pr-audio-stream').PrAudioStream | undefined;
36
36
  getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<import('./types').DeviceInfo[]>;
37
37
  getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
38
38
  getMediaDevicesErrInfo: () => Promise<{
39
39
  mc_audio: string;
40
40
  mc_video: string;
41
41
  }>;
42
- setCallStrategy: (callStrategy: import('./enums/callStrategy').K_callStrategy, mediaTypes?: import('./enums/mediaType').K_mediaType[]) => Promise<void>;
43
- setLocalStream: (mediaTypes: import('./enums/mediaType').K_mediaType[], active: boolean) => Promise<unknown>;
42
+ setCallStrategy: (callStrategy: import('./enums').K_callStrategy, mediaTypes?: import('./enums').K_mediaType[]) => Promise<void>;
43
+ setLocalStream: (mediaTypes: import('./enums').K_mediaType[], active: boolean) => Promise<unknown>;
44
44
  setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<unknown>;
45
- setMediaTrackConstraints: (mediaType: import('./enums/mediaType').K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
46
- earlyConnect: (mediaTypes?: import('./enums/mediaType').K_mediaType[]) => Promise<unknown>;
45
+ setMediaTrackConstraints: (mediaType: import('./enums').K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
46
+ earlyConnect: (mediaTypes?: import('./enums').K_mediaType[]) => Promise<unknown>;
47
47
  joinRoom: (roomOptions: import('./types').RoomOptions) => Promise<unknown>;
48
- publish: (mediaTypes: import('./enums/mediaType').K_mediaType[]) => Promise<boolean>;
49
- stopPublish: (mediaTypes: import('./enums/mediaType').K_mediaType[]) => Promise<boolean>;
50
- pauseTracks: (mediaTypes: import('./enums/mediaType').K_mediaType[], pause: boolean) => Promise<boolean>;
48
+ publish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<boolean>;
49
+ stopPublish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<boolean>;
50
+ pauseTracks: (mediaTypes: import('./enums').K_mediaType[], pause: boolean) => Promise<boolean>;
51
51
  subscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<unknown>;
52
52
  stopSubscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<boolean>;
53
53
  toggleRoomSpeechLang: (data: {
@@ -59,9 +59,9 @@ export declare class QuickVO {
59
59
  quitRoom: () => Promise<boolean>;
60
60
  quitRoomEx: () => Promise<boolean>;
61
61
  destroy: () => void;
62
- getLocalUserTrackReports: (mediaType: import('./enums/mediaType').K_mediaType) => import('./types').TrackReport;
63
- getRemoteUserTrackReports: (userId: string, origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: import('./enums/mediaType').K_mediaType) => import('./types').TrackReport | undefined;
64
- _openP2P: (remoteUserId: string, mediaTypes: import('./enums/mediaType').K_mediaType[], isRemotePush: boolean) => Promise<unknown>;
62
+ getLocalUserTrackReports: (mediaType: import('./enums').K_mediaType) => import('./types').TrackReport;
63
+ getRemoteUserTrackReports: (userId: string, origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: import('./enums').K_mediaType) => import('./types').TrackReport | undefined;
64
+ _openP2P: (remoteUserId: string, mediaTypes: import('./enums').K_mediaType[], isRemotePush: boolean) => Promise<unknown>;
65
65
  _restoreRoom: () => Promise<void>;
66
66
  _debugger: () => Promise<void>;
67
67
  _ai: () => Promise<void>;
@@ -1,6 +1,5 @@
1
1
  import { TrackReport } from '../../../../types';
2
2
  export declare class RemotePeerTrackAnalysis {
3
- types: string[];
4
3
  trackReport: TrackReport;
5
4
  packetsSent: number;
6
5
  packetsLost: number;
@@ -30,7 +30,6 @@ export declare class RemoteUserP2P {
30
30
  [key in K_mediaType]?: boolean;
31
31
  };
32
32
  tracks: MediaStreamTrack[];
33
- averageOffsetBytesSents: number[];
34
33
  on: On;
35
34
  waitings: {
36
35
  candidateCollected: () => Promise<unknown>;
@@ -42,8 +41,6 @@ export declare class RemoteUserP2P {
42
41
  config: Config;
43
42
  remoteUserId: string;
44
43
  });
45
- getAverageOffsetBytesSent: () => number | undefined;
46
- saveAverageOffsetBytesSents: (averageOffsetBytesSent: number) => void;
47
44
  remoteChannelSend: (message: any) => Promise<void>;
48
45
  init: () => void;
49
46
  initSenders: (mediaType_transceivers?: MediaTypeTransceiver[], direction?: RTCRtpTransceiverDirection) => ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
@@ -0,0 +1,7 @@
1
+ export * from './callStrategy';
2
+ export * from './eventName';
3
+ export * from './notifyName';
4
+ export * from './mediaType';
5
+ export * from './quality';
6
+ export * from './roomState';
7
+ export * from './trackType';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './QuickVO';
2
2
  export * from './types';
3
+ export * from './enums/index';