quickvo-sdk-js 1.6.3 → 1.6.5

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
@@ -10,7 +10,7 @@ export declare class QuickVO {
10
10
  clearRequestAnimationFrame: (keys?: string[]) => Promise<number[]>;
11
11
  addNotify: (notify: {
12
12
  sn?: string;
13
- event: "onJoinRoom" | "onQuitRoom" | "onBeforeTokenExpire" | "onTokenExpired" | "onDestroyRoom" | "onCDNPlayUrlAdd" | "onRoomUserSpeech" | "onRoomUsers" | "onRoomNetwork" | "onPeerState" | "onRoomState";
13
+ event: "onJoinRoom" | "onQuitRoom" | "onPublish" | "onBeforeTokenExpire" | "onTokenExpired" | "onDestroyRoom" | "onCDNPlayUrlAdd" | "onRoomUserSpeech" | "onRoomUsers" | "onRoomNetwork" | "onDevicechange" | "onPeerState" | "onRoomState";
14
14
  callback?: (e: any) => void;
15
15
  }) => string;
16
16
  setOptions: (options: Partial<QuickOptions & import('./types').RoomOptions>) => void;
@@ -34,6 +34,7 @@ export declare class QuickVO {
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
36
  getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<MediaDeviceInfo[]>;
37
+ getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
37
38
  getMediaDevicesErrInfo: () => Promise<{
38
39
  mc_audio: string;
39
40
  mc_video: string;
@@ -1,4 +1,7 @@
1
1
  import { K_mediaType } from '../../enums/mediaType';
2
+ interface On {
3
+ devicechange?: () => void;
4
+ }
2
5
  export declare class LocalMedias {
3
6
  audioContext: AudioContext;
4
7
  private phoneyStreamTracks;
@@ -9,6 +12,7 @@ export declare class LocalMedias {
9
12
  */
10
13
  private mediaTrackConstraints;
11
14
  private localStreamTracks;
15
+ on: On;
12
16
  constructor();
13
17
  /**
14
18
  *
@@ -83,3 +87,4 @@ export declare class LocalMedias {
83
87
  getEnumerateVideoinputDevices: () => Promise<MediaDeviceInfo[]>;
84
88
  private _getAllEnumerateDevices;
85
89
  }
90
+ export {};
@@ -1,4 +1,4 @@
1
- type NotifyName = 'onRoomUsers' | 'onJoinRoom' | 'onQuitRoom' | 'onRoomNetwork' | 'onCDNPlayUrlAdd' | 'onRoomUserSpeech' | 'onBeforeTokenExpire' | 'onTokenExpired' | 'onPeerState' | 'onRoomState' | 'onDestroyRoom';
1
+ type NotifyName = 'onRoomUsers' | 'onJoinRoom' | 'onPublish' | 'onQuitRoom' | 'onRoomNetwork' | 'onDevicechange' | 'onCDNPlayUrlAdd' | 'onRoomUserSpeech' | 'onBeforeTokenExpire' | 'onTokenExpired' | 'onPeerState' | 'onRoomState' | 'onDestroyRoom';
2
2
  /**
3
3
  * 广播
4
4
  */
@@ -1,6 +1,5 @@
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';
@@ -10,15 +9,11 @@ interface On {
10
9
  export declare class Peer {
11
10
  config: Config;
12
11
  users: Users;
13
- prResolves: PrResolves<"iceConnected">;
14
12
  pc: RTCPeerConnection;
15
13
  transceiverMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", RTCRtpTransceiver>;
16
14
  transceiverTrackMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", UserTrack>;
17
15
  private iceConnectionTimer;
18
16
  simulcast: 'f' | 'h' | 'q';
19
- waitings: {
20
- iceConnected: () => Promise<unknown>;
21
- };
22
17
  on: On;
23
18
  constructor({ config, users }: {
24
19
  config: Config;
@@ -51,5 +46,12 @@ export declare class Peer {
51
46
  createAnswer: () => Promise<void>;
52
47
  getSdp: () => string;
53
48
  setRemoteDescription: (description: RTCSessionDescriptionInit) => Promise<RTCSessionDescriptionInit>;
49
+ waitings: {
50
+ /**
51
+ * 等待连接成功
52
+ * @returns
53
+ */
54
+ peerConnected: () => Promise<unknown>;
55
+ };
54
56
  }
55
57
  export {};
@@ -1,9 +1,8 @@
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';
7
6
  export interface CallsWebSocketOptions {
8
7
  /**
9
8
  * websocket服务地址
@@ -19,41 +18,30 @@ export interface CallsWebSocketOptions {
19
18
  debug?: boolean;
20
19
  }
21
20
  export declare class CallsWebSocket {
22
- #private;
23
21
  config: Config;
24
22
  timeout: number;
25
- prws?: PrWebSocket;
26
- prResolves: PrResolves<"cwsConnected">;
27
- activeTimeStamp: number;
23
+ prws: PrWebSocket;
28
24
  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
25
  on: {
30
26
  [key in K_notifyName]?: Function;
31
27
  } & {
32
- close?: Function;
33
- };
34
- waitings: {
35
- cwsConnected: () => Promise<unknown>;
28
+ close?: (e: any) => void;
29
+ error?: (e: any) => void;
36
30
  };
37
31
  constructor({ config }: {
38
32
  config: Config;
39
33
  });
40
34
  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
- */
35
+ connect: (url: string) => Promise<void>;
36
+ close: () => void;
58
37
  createRequest: <T extends K_eventName>(eventName: T, options?: Options) => CallsWebSocketEvent<T>;
38
+ clearEvents: () => void;
39
+ waitings: {
40
+ /**
41
+ * 等待连接成功
42
+ * @returns
43
+ */
44
+ cwsConnected: () => Promise<unknown>;
45
+ };
46
+ private _updataLogs;
59
47
  }
@@ -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 {};
@@ -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
  /**