quickvo-sdk-js 1.6.4 → 1.6.6

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/dist/QuickVO.d.ts CHANGED
@@ -33,7 +33,7 @@ export declare class QuickVO {
33
33
  setEnhanceGain: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => Promise<void>;
34
34
  setSpeakerVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => void;
35
35
  getUserAudioMediaStreamContext: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => import('pr-audio-stream').PrAudioStream | undefined;
36
- getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<MediaDeviceInfo[]>;
36
+ getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<import('./types').DeviceInfo[]>;
37
37
  getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
38
38
  getMediaDevicesErrInfo: () => Promise<{
39
39
  mc_audio: string;
@@ -1,4 +1,5 @@
1
1
  import { K_mediaType } from '../../enums/mediaType';
2
+ import { DeviceInfo } from '../../types';
2
3
  interface On {
3
4
  devicechange?: () => void;
4
5
  }
@@ -69,22 +70,23 @@ export declare class LocalMedias {
69
70
  * @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
70
71
  * @returns MediaDeviceInfo[]
71
72
  */
72
- getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<MediaDeviceInfo[]>;
73
+ getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<DeviceInfo[]>;
73
74
  /**
74
75
  * getEnumerateAudioinputDevices
75
76
  * @returns MediaDeviceInfo[]
76
77
  */
77
- getEnumerateAudioinputDevices: () => Promise<MediaDeviceInfo[]>;
78
+ getEnumerateAudioinputDevices: () => Promise<DeviceInfo[]>;
78
79
  /**
79
80
  * getEnumerateAudioOutputDevices
80
81
  * @returns MediaDeviceInfo[]
81
82
  */
82
- getEnumerateAudioOutputDevices: () => Promise<MediaDeviceInfo[]>;
83
+ getEnumerateAudioOutputDevices: () => Promise<DeviceInfo[]>;
83
84
  /**
84
85
  * getEnumerateVideoinputDevices
85
86
  * @returns MediaDeviceInfo[]
86
87
  */
87
- getEnumerateVideoinputDevices: () => Promise<MediaDeviceInfo[]>;
88
+ getEnumerateVideoinputDevices: () => Promise<DeviceInfo[]>;
88
89
  private _getAllEnumerateDevices;
90
+ private _getSafetyMediaDeviceKind;
89
91
  }
90
92
  export {};
@@ -1,25 +1,25 @@
1
1
  import { K_mediaType } from '../../enums/mediaType';
2
2
  import { UserTrack } from '../../types';
3
- import { PrResolves } from './cws/PrResolves';
4
3
  import { K_callStrategy } from '../../enums/callStrategy';
5
4
  import { Config } from './Config';
6
5
  import { Users } from './users/Users';
6
+ import { PrResolves } from './PrResolves';
7
7
  interface On {
8
8
  state?: (_state: 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed') => void;
9
9
  }
10
10
  export declare class Peer {
11
11
  config: Config;
12
12
  users: Users;
13
- prResolves: PrResolves<"iceConnected">;
13
+ prResolves: PrResolves<"peerConnected">;
14
14
  pc: RTCPeerConnection;
15
15
  transceiverMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", RTCRtpTransceiver>;
16
16
  transceiverTrackMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", UserTrack>;
17
17
  private iceConnectionTimer;
18
18
  simulcast: 'f' | 'h' | 'q';
19
+ on: On;
19
20
  waitings: {
20
- iceConnected: () => Promise<unknown>;
21
+ peerConnected: () => Promise<unknown>;
21
22
  };
22
- on: On;
23
23
  constructor({ config, users }: {
24
24
  config: Config;
25
25
  users: Users;
@@ -1,12 +1,12 @@
1
1
  type ResolveInfo = Map<string, {
2
- resolve: Function;
2
+ resolve: (error?: string) => void;
3
3
  timer: number;
4
4
  }>;
5
5
  export declare class PrResolves<T extends string> {
6
6
  resolvesMap: Map<string, ResolveInfo>;
7
7
  index: number;
8
8
  constructor();
9
- emit: (eventKey: T) => Promise<void>;
9
+ emit: (eventKey: T, error?: string) => Promise<void>;
10
10
  /**
11
11
  *
12
12
  * @param eventKey 唯一key
@@ -1,9 +1,9 @@
1
- import { PrWebSocket } from 'pr-ws';
2
1
  import { K_notifyName } from '../../../enums/notifyName';
3
2
  import { K_eventName } from '../../../enums/eventName';
4
3
  import { CallsWebSocketEvent, Options } from './CallsWebSocketEvent';
5
- import { PrResolves } from './PrResolves';
6
4
  import { Config } from '../Config';
5
+ import { PrWebSocket } from './PrWebSocket';
6
+ import { PrResolves } from '../PrResolves';
7
7
  export interface CallsWebSocketOptions {
8
8
  /**
9
9
  * websocket服务地址
@@ -19,17 +19,16 @@ export interface CallsWebSocketOptions {
19
19
  debug?: boolean;
20
20
  }
21
21
  export declare class CallsWebSocket {
22
- #private;
23
22
  config: Config;
24
23
  timeout: number;
25
- prws?: PrWebSocket;
24
+ prws: PrWebSocket;
26
25
  prResolves: PrResolves<"cwsConnected">;
27
- activeTimeStamp: number;
28
26
  events: Map<"heartbeat" | "heartbeatEx" | "ackMsg" | "reportNetwork" | "connectCF" | "publish" | "joinRoom" | "joinRoomEx" | "pubNotify" | "subscribe" | "renegotiate" | "closeTrack" | "preventUsersBehavior" | "networkQualityChange" | "updateCall" | "toggleRoomSpeechLang" | "syncRoomInfo" | "updateRoomToken" | "offer" | "answer" | "candidate" | "reportP2PConnectEx" | "quitRoom" | "quitRoomEx" | "debugger" | "ai" | "UpdateTrackActive", CallsWebSocketEvent<any>>;
29
27
  on: {
30
28
  [key in K_notifyName]?: Function;
31
29
  } & {
32
- close?: Function;
30
+ close?: (e: any) => void;
31
+ error?: (e: any) => void;
33
32
  };
34
33
  waitings: {
35
34
  cwsConnected: () => Promise<unknown>;
@@ -38,22 +37,9 @@ export declare class CallsWebSocket {
38
37
  config: Config;
39
38
  });
40
39
  needRestoreRoom: () => boolean;
41
- /**
42
- * fetchUrl
43
- */
44
- getUrl: (env?: "local" | "dev" | "prod") => Promise<void>;
45
- clearEvents: () => void;
46
- /**
47
- * 重发消息
48
- */
49
- afreshSends: () => void;
50
- connect: (url?: string) => Promise<unknown>;
51
- /**
52
- * 关闭
53
- */
54
- close: () => Promise<void>;
55
- /**
56
- * 创建请求
57
- */
40
+ connect: (url: string) => Promise<void>;
41
+ close: () => void;
58
42
  createRequest: <T extends K_eventName>(eventName: T, options?: Options) => CallsWebSocketEvent<T>;
43
+ clearEvents: () => void;
44
+ private _updataLogs;
59
45
  }
@@ -1,30 +1,25 @@
1
1
  import { K_eventName } from '../../../enums/eventName';
2
- import { PrWebSocket } from 'pr-ws';
3
2
  import { MessageReq, MessageRsp } from '../../../protos/protoEvent';
3
+ import { PrWebSocket } from './PrWebSocket';
4
4
  export interface Options {
5
5
  /**
6
6
  * 超时时间 默认10s
7
7
  */
8
8
  timeout?: number;
9
- /**
10
- * 重试次数
11
- */
12
- retryCount?: number;
13
9
  /**
14
10
  * 是否监听返回
15
11
  */
16
12
  onBack?: boolean;
17
13
  }
18
14
  export declare class CallsWebSocketEvent<T extends K_eventName> {
19
- prws: PrWebSocket;
20
15
  eventName: K_eventName;
16
+ prws: PrWebSocket;
21
17
  message?: MessageReq<T>;
22
18
  _resolve: (_value: Pick<MessageRsp<T>, "event" | "sn" | "data" | "code" | "desc">) => void;
23
19
  _reject: (_reason?: any) => void;
24
20
  sendBefore?: (_message: MessageReq<T>) => void;
25
21
  options: {
26
22
  timeout: number;
27
- retryCount: number;
28
23
  onBack: boolean;
29
24
  };
30
25
  timer: number;
@@ -0,0 +1,48 @@
1
+ interface On {
2
+ /**
3
+ * 消息回调
4
+ * @description 接收当前WebSocket的所有消息
5
+ */
6
+ message?: (_e: any) => void;
7
+ /**
8
+ * 连接成功
9
+ */
10
+ open?: (elapsed: number) => void;
11
+ /**
12
+ * 连接错误
13
+ */
14
+ error?: (e: any) => void;
15
+ /**
16
+ * 连接关闭
17
+ */
18
+ close?: (e: any) => void;
19
+ }
20
+ export declare class PrWebSocket {
21
+ binaryType: BinaryType;
22
+ debug: boolean;
23
+ url: string;
24
+ activeTimeStamp: number;
25
+ ws?: WebSocket;
26
+ on: On;
27
+ constructor();
28
+ /**
29
+ *
30
+ * @param url 连接地址
31
+ * @returns
32
+ */
33
+ connect: (url: string) => void;
34
+ /**
35
+ * 重新连接
36
+ */
37
+ reconnect: () => void;
38
+ /**
39
+ * 发送消息
40
+ */
41
+ send: (_data: string | ArrayBufferLike | Blob | ArrayBufferView) => void;
42
+ /**
43
+ * 关闭
44
+ */
45
+ close: (code?: number, reason?: string) => void;
46
+ private _open;
47
+ }
48
+ export {};
@@ -1,4 +1,4 @@
1
- import { PrResolves } from '../../cws/PrResolves';
1
+ import { PrResolves } from '../../PrResolves';
2
2
  import { K_mediaType } from '../../../../enums/mediaType';
3
3
  import { Config } from '../../Config';
4
4
  export interface MediaTypeTransceiver {
@@ -63,16 +63,10 @@ export declare class UserBase {
63
63
  * 是否为自己
64
64
  */
65
65
  isSelf: boolean;
66
- /**
67
- * 用户输入媒体流
68
- */
69
- inputStreams: {
70
- [key in K_mediaType]: MediaStream;
71
- };
72
66
  /**
73
67
  * 用户流控制器
74
68
  */
75
- controlStreams: {
69
+ streamControls: {
76
70
  mc_audio?: PrAudioStream;
77
71
  mc_video?: undefined;
78
72
  ss_video?: undefined;
@@ -81,7 +75,7 @@ export declare class UserBase {
81
75
  /**
82
76
  * 用户输出媒体流
83
77
  */
84
- outputStreams: {
78
+ streams: {
85
79
  [key in K_mediaType]: MediaStream;
86
80
  };
87
81
  /**