quickvo-sdk-js 1.6.71 → 1.6.73

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.
Files changed (45) hide show
  1. package/dist/chunk-BXUcB7os.js +58 -0
  2. package/dist/index.js +18438 -18577
  3. package/dist/index.umd.cjs +4 -4
  4. package/dist/lib-9TnBQie8.js +11083 -0
  5. package/dist/src/action/ActionSFU.d.ts +12 -23
  6. package/dist/src/action/Task.d.ts +3 -27
  7. package/dist/src/base/Base.d.ts +1 -1
  8. package/dist/src/base/modules/Notifys.d.ts +15 -5
  9. package/dist/src/base/modules/Peer.d.ts +17 -1
  10. package/dist/src/base/modules/cws/CallsWebSocket.d.ts +34 -22
  11. package/dist/src/base/modules/cws/CallsWebSocketEvent.d.ts +7 -8
  12. package/dist/src/base/modules/cws/PrWebSocket.d.ts +2 -0
  13. package/dist/src/base/modules/users/Users.d.ts +3 -7
  14. package/dist/src/base/modules/users/modules/RemotePeerTrackAnalysis.d.ts +5 -0
  15. package/dist/src/base/modules/users/modules/RemoteUser.d.ts +6 -0
  16. package/dist/src/base/modules/users/modules/RemoteUserP2P.d.ts +3 -5
  17. package/dist/src/base/modules/users/modules/UserBase.d.ts +14 -2
  18. package/dist/src/base/modules/webmDurationFixWorkerMain.d.ts +2 -0
  19. package/dist/src/enums/eventName.d.ts +6 -1
  20. package/dist/src/enums/mediaType.d.ts +3 -0
  21. package/dist/src/enums/notifyName.d.ts +3 -1
  22. package/dist/src/index.d.ts +0 -4
  23. package/dist/src/protos/gen/{modules/BaseData_pb.d.ts → BaseData_pb.d.ts} +2 -2
  24. package/dist/src/protos/gen/{modules/Room_pb.d.ts → Room_pb.d.ts} +16 -90
  25. package/dist/src/protos/gen/Rtc_pb.d.ts +154 -0
  26. package/dist/src/protos/index.d.ts +3 -4
  27. package/dist/src/protos/protoEvent.d.ts +76 -146
  28. package/dist/src/tools.d.ts +1 -1
  29. package/dist/src/types.d.ts +0 -12
  30. package/dist/src/workers/protos/WorkerCore.d.ts +8 -0
  31. package/dist/src/workers/protos/index.d.ts +10 -0
  32. package/dist/src/workers/protos/types.d.ts +8 -0
  33. package/package.json +6 -5
  34. package/dist/chunk-C3ZmwZ-K.js +0 -57
  35. package/dist/index.d.ts +0 -2
  36. package/dist/lib-Cen0reYH.js +0 -11194
  37. package/dist/src/QuickVO.d.ts +0 -85
  38. package/dist/src/base/modules/cws/quickvoCodecWorkerMain.d.ts +0 -6
  39. package/dist/src/base/modules/notifyPayloadMap.d.ts +0 -119
  40. package/dist/src/protos/gen/modules/Rtc_pb.d.ts +0 -70
  41. package/dist/src/protos/protoCodec.d.ts +0 -19
  42. package/dist/src/workers/cwsCodec/CwsCodecCore.d.ts +0 -7
  43. package/dist/src/workers/cwsCodec/CwsCodecWorker.d.ts +0 -15
  44. package/dist/src/workers/cwsCodec/type.d.ts +0 -33
  45. /package/dist/src/workers/{cwsCodec/cwsCodec.worker.d.ts → protos/protos.worker.d.ts} +0 -0
@@ -1,85 +0,0 @@
1
- import { QuickOptions } from './types';
2
- export declare class QuickVO {
3
- static version: string;
4
- private _base;
5
- /** 监听注册顺序:Base → ActionBase → ActionSFU → ActionP2P;同名 cws.on.* 以后构造者为准(房间/进房等由 ActionSFU 注册) */
6
- private _ACTION_BASE;
7
- private _ACTION_SFU;
8
- private _ACTION_P2P;
9
- constructor(options: QuickOptions);
10
- recorder: import('./base/modules/StreamRecorder').StreamRecorder;
11
- use: ({ rnnoise }: {
12
- rnnoise?: import('./base/Base').PrRnnoise;
13
- }) => void;
14
- setCallStrategy: (callStrategy: import('./enums').K_callStrategy, mediaTypes?: import('./enums').K_mediaType[]) => Promise<void>;
15
- addNotify: (notify: import('./base/modules/notifyPayloadMap').QuickvoNotify) => string;
16
- setOptions: (options: Partial<QuickOptions & import('./types').RoomOptions>) => void;
17
- getLocalStream: (mediaType: import('./enums').K_mediaType) => MediaStream;
18
- getLocalStreams: () => {
19
- mc_audio: MediaStream;
20
- mc_video: MediaStream;
21
- ss_video: MediaStream;
22
- ss_audio: MediaStream;
23
- };
24
- setActiveNoise: (mediaType: import('./enums').K_mediaType, state: boolean) => void;
25
- hasPermissions: (type: "subscribe" | "publish") => boolean;
26
- getUserContent: (userId?: string) => import('./base/modules/users/modules/LocalUser').LocalUser | import('./base/modules/users/modules/RemoteUser').RemoteUser | undefined;
27
- getUserStream: (userId: string, mediaType: import('./enums').K_mediaType) => MediaStream | undefined;
28
- getVolume: (userId: string, mediaType: import('./enums').K_mediaType) => number | undefined;
29
- getMaxVolumeUser: () => {
30
- id: string;
31
- volume: number;
32
- } | undefined;
33
- setInputVolume: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => void;
34
- setEnhanceGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
35
- setSpeakerVolume: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => void;
36
- getUserAudioMediaStreamContext: (userId: string, mediaType: import('./enums').K_mediaType) => import('pr-audio-stream').PrAudioStream | undefined;
37
- playBgs: (userId: string, mediaType: import('./enums').K_mediaType, buffer: AudioBuffer | null) => Promise<void>;
38
- changBgsMix: (userId: string, mediaType: import('./enums').K_mediaType, mix: boolean) => Promise<void>;
39
- stopBgs: (userId: string, mediaType: import('./enums').K_mediaType) => Promise<void>;
40
- setBgsGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
41
- playBgm: (userId: string, mediaType: import('./enums').K_mediaType, buffer: AudioBuffer | null) => Promise<void>;
42
- changBgmMix: (userId: string, mediaType: import('./enums').K_mediaType, mix: boolean) => Promise<void>;
43
- stopBgm: (userId: string, mediaType: import('./enums').K_mediaType) => Promise<void>;
44
- setBgmGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
45
- getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<import('./types').DeviceInfo[]>;
46
- getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
47
- getMediaDevicesErrInfo: () => Promise<{
48
- mc_audio: string;
49
- mc_video: string;
50
- }>;
51
- setLocalStream: (mediaTypes: import('./enums').K_mediaType[], active: boolean) => Promise<void>;
52
- setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<void>;
53
- setMediaTrackConstraints: (mediaType: import('./enums').K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
54
- earlyConnect: () => Promise<true | undefined>;
55
- joinRoom: (roomOptions: import('./types').RoomOptions) => Promise<string>;
56
- publish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<true>;
57
- stopPublish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<true>;
58
- subscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<true>;
59
- stopSubscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<true>;
60
- setBehaviors: (usersBehaviors: Array<{
61
- id: string;
62
- behaviors: { [key in import('./enums').K_mediaType]?: boolean; };
63
- }>) => Promise<import('./protos/protoEvent').MessageRspCore<"preventUsersBehavior">>;
64
- updateSimulcast: (simulcast: "f" | "h" | "q") => Promise<void>;
65
- toggleRoomSpeechLang: (data: {
66
- input: string;
67
- output: string;
68
- translateEnable?: boolean;
69
- }) => void;
70
- updateToken: (sdkToken: string) => void;
71
- quitRoom: () => Promise<string>;
72
- quitRoomEx: () => Promise<string>;
73
- destroy: () => void;
74
- addRequestAnimationFrame: (key: string, func: FrameRequestCallback, options?: {
75
- fps?: number;
76
- }) => void;
77
- clearRequestAnimationFrame: (keys?: string[]) => void;
78
- getLocalUserTrackReports: (mediaType: import('./enums').K_mediaType) => import('./types').TrackReport;
79
- getRemoteUserTrackReports: (userId: string, origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: import('./enums').K_mediaType) => import('./types').TrackReport | undefined;
80
- getRoomAction: () => number;
81
- _openP2P: (remoteUserId: string, mediaTypes: import('./enums').K_mediaType[], isRemotePush: boolean) => Promise<void>;
82
- _restoreRoom: () => Promise<void>;
83
- _debugger: () => Promise<void>;
84
- _ai: () => Promise<void>;
85
- }
@@ -1,6 +0,0 @@
1
- import { OnMessageFormatResult } from '../../../protos/protoEvent';
2
- export declare function decodeCwsBinary<E extends string = string>(buffer: ArrayBuffer): Promise<OnMessageFormatResult<E>>;
3
- /** gzip 压缩(发送侧 / 日志上报);失败时回退主线程 pako */
4
- export declare function gzipCompressBytes(data: Uint8Array): Promise<Uint8Array>;
5
- /** 终止 CWS 编解码 Worker;`QuickVO.destroy` 时应调用。之后可再次懒创建 Worker。 */
6
- export declare function destroyQuickvoCodecWorker(): void;
@@ -1,119 +0,0 @@
1
- import { K_notifyName } from '../../enums/notifyName';
2
- import { K_roomState } from '../../enums/roomState';
3
- import { CwsNotifyPayloadFor } from '../../protos/protoEvent';
4
- import { RoomUser } from '../../types';
5
- /**
6
- * SDK 内部派发的通知名(不经由 CWS OnMessageDataMap)
7
- */
8
- export type SdkOnlyNotifyName = 'onLog' | 'onRoomUsers' | 'onRoomNetwork' | 'onDevicechange' | 'onPeerState' | 'onRoomState';
9
- /** QuickVO.addNotify / Notifys 支持的完整事件名 */
10
- export type K_quickvoNotifyName = K_notifyName | SdkOnlyNotifyName;
11
- type WithSn<T> = T & {
12
- sn?: string;
13
- };
14
- type CwsNotifyPayloadWithSn<K extends K_notifyName> = WithSn<CwsNotifyPayloadFor<K>>;
15
- /** 与 Config.network / ActionSFU 网络汇总一致 */
16
- export type RoomNetworkNotifyData = {
17
- sfu: {
18
- inboundBytes: number;
19
- outboundBytes: number;
20
- lostRate: number;
21
- roundTripTime: number;
22
- jitter: number;
23
- quality: number;
24
- averageQuality: number;
25
- velocityPush: number;
26
- velocityPull: number;
27
- };
28
- p2p: {
29
- inboundBytes: number;
30
- outboundBytes: number;
31
- lostRate: number;
32
- roundTripTime: number;
33
- jitter: number;
34
- quality: number;
35
- averageQuality: number;
36
- velocityPush: number;
37
- velocityPull: number;
38
- };
39
- };
40
- /** 与 Base._reportLog 的 type 参数一致 */
41
- export type ReportLogNotifyType = 'ws_c_timeout' | 'webrtc_c_timeout' | 'join_room_error' | 'publish_error' | 'subscribe_error' | 'close_track_error' | 'heartbeat_e_timeout' | 'heartbeat_i_timeout' | 'quit_room_error';
42
- /**
43
- * 各通知事件 emit 第二参 / callback 第一参的精确类型
44
- */
45
- export type NotifyPayloadMap = {
46
- [K in K_notifyName]: CwsNotifyPayloadWithSn<K>;
47
- } & {
48
- onLog: WithSn<{
49
- code: number;
50
- desc: string;
51
- data: {
52
- message: unknown;
53
- } | {
54
- type: ReportLogNotifyType;
55
- };
56
- }>;
57
- onRoomUsers: WithSn<{
58
- code: number;
59
- desc: string;
60
- data: RoomUser[];
61
- }>;
62
- onRoomNetwork: WithSn<{
63
- code: number;
64
- desc: string;
65
- data: RoomNetworkNotifyData;
66
- }>;
67
- onDevicechange: WithSn<{
68
- code: number;
69
- desc: string;
70
- data: Record<string, never>;
71
- }>;
72
- onPeerState: WithSn<{
73
- code: number;
74
- desc: string;
75
- data: {
76
- state: RTCPeerConnectionState;
77
- };
78
- }>;
79
- onRoomState: WithSn<{
80
- code: number;
81
- desc: string;
82
- data: {
83
- state: K_roomState;
84
- };
85
- }>;
86
- };
87
- export type NotifyEmitPayloadFor<E extends K_quickvoNotifyName> = NotifyPayloadMap[E];
88
- /** 所有通知 payload 的联合(需按 event 收窄时请用 NotifyEmitPayloadFor<E>) */
89
- export type NotifyEmitPayloadUnion = NotifyPayloadMap[K_quickvoNotifyName];
90
- /**
91
- * addNotify 注册的 discriminated union:event 与 callback 参数类型联动
92
- */
93
- export type QuickvoNotify = {
94
- [E in K_quickvoNotifyName]: {
95
- sn?: string;
96
- event: E;
97
- callback?: (e: NotifyPayloadMap[E]) => void;
98
- };
99
- }[K_quickvoNotifyName];
100
- /**
101
- * 辅助推断:注册通知时无需手写 payload 泛型
102
- * @example
103
- * ```ts
104
- * quickvo.addNotify(defineQuickvoNotify({
105
- * event: 'onJoinRoom',
106
- * callback: (e) => e.data.user,
107
- * }))
108
- * ```
109
- */
110
- export declare function defineQuickvoNotify<const E extends K_quickvoNotifyName>(notify: {
111
- sn?: string;
112
- event: E;
113
- callback?: (e: NotifyPayloadMap[E]) => void;
114
- }): {
115
- sn?: string;
116
- event: E;
117
- callback?: (e: NotifyPayloadMap[E]) => void;
118
- };
119
- export {};
@@ -1,70 +0,0 @@
1
- import { GenEnum, GenFile, GenMessage } from '@bufbuild/protobuf/codegenv2';
2
- import { TrackType } from './Room_pb';
3
- import { Message } from '@bufbuild/protobuf';
4
- /**
5
- * Describes the file modules/Rtc.proto.
6
- */
7
- export declare const file_modules_Rtc: GenFile;
8
- /**
9
- * @generated from message com.quick.voice.proto.RtcTrack
10
- */
11
- export type RtcTrack = Message<"com.quick.voice.proto.RtcTrack"> & {
12
- /**
13
- * @generated from field: string userId = 1;
14
- */
15
- userId: string;
16
- /**
17
- * @generated from field: string mid = 2;
18
- */
19
- mid: string;
20
- /**
21
- * @generated from field: string trackName = 3;
22
- */
23
- trackName: string;
24
- /**
25
- * 与 Room.proto 中 TrackType 数值一致,避免同 package 下重复枚举符号(buf/protoc 要求)
26
- *
27
- * @generated from field: com.quick.voice.proto.TrackType type = 4;
28
- */
29
- type: TrackType;
30
- /**
31
- * @generated from field: bool isActive = 5;
32
- */
33
- isActive: boolean;
34
- };
35
- /**
36
- * Describes the message com.quick.voice.proto.RtcTrack.
37
- * Use `create(RtcTrackSchema)` to create a new message.
38
- */
39
- export declare const RtcTrackSchema: GenMessage<RtcTrack>;
40
- /**
41
- * @generated from message com.quick.voice.proto.UpdateTrackState
42
- */
43
- export type UpdateTrackState = Message<"com.quick.voice.proto.UpdateTrackState"> & {
44
- /**
45
- * @generated from field: string roomId = 1;
46
- */
47
- roomId: string;
48
- /**
49
- * @generated from field: repeated com.quick.voice.proto.RtcTrack tracks = 2;
50
- */
51
- tracks: RtcTrack[];
52
- };
53
- /**
54
- * Describes the message com.quick.voice.proto.UpdateTrackState.
55
- * Use `create(UpdateTrackStateSchema)` to create a new message.
56
- */
57
- export declare const UpdateTrackStateSchema: GenMessage<UpdateTrackState>;
58
- /**
59
- * @generated from enum com.quick.voice.proto.RtcEvent
60
- */
61
- export declare enum RtcEvent {
62
- /**
63
- * @generated from enum value: UpdateTrackActive = 0;
64
- */
65
- UpdateTrackActive = 0
66
- }
67
- /**
68
- * Describes the enum com.quick.voice.proto.RtcEvent.
69
- */
70
- export declare const RtcEventSchema: GenEnum<RtcEvent>;
@@ -1,19 +0,0 @@
1
- import { CommonRsp } from './gen/modules/BaseData_pb';
2
- /** 与原先 protobufjs 在业务侧用法对齐:CommonRsp 外层 sn/time/valid 使用 number */
3
- export type CommonRspDecoded = Omit<CommonRsp, 'sn' | 'time' | 'valid'> & {
4
- sn: number;
5
- time: number;
6
- valid: number;
7
- };
8
- /** @bufbuild/protobuf 解码后的消息会带运行时字段 `$typeName`,业务/日志里不需要,递归去掉 */
9
- export declare function stripProtobufRuntimeMeta<T>(value: T): T;
10
- export declare function decodeCommonRsp(buffer: Uint8Array): CommonRspDecoded;
11
- export declare function encodeCommonReq(init: {
12
- event: string;
13
- data: Uint8Array;
14
- sn?: number;
15
- time?: number;
16
- valid?: number;
17
- version?: number;
18
- compress?: boolean;
19
- }): Uint8Array;
@@ -1,7 +0,0 @@
1
- /** 仅在 Worker 内实例化:解码 + gzip(与主线程逻辑一致) */
2
- export declare class CwsCodecCore {
3
- decode(buffer: ArrayBuffer): {
4
- data_remote: Uint8Array<ArrayBuffer>;
5
- };
6
- gzipCompress(buffer: ArrayBuffer): Uint8Array;
7
- }
@@ -1,15 +0,0 @@
1
- import { OnMessageFormatResult } from '../../protos/protoEvent';
2
- export type CwsCodecWorkerOptions = {
3
- onFatal?: () => void;
4
- };
5
- export declare class CwsCodecWorker {
6
- worker: Worker;
7
- private nextId;
8
- private pending;
9
- private options;
10
- constructor(options?: CwsCodecWorkerOptions);
11
- private failAll;
12
- decode(buffer: ArrayBuffer): Promise<OnMessageFormatResult>;
13
- gzipCompress(buffer: ArrayBuffer): Promise<Uint8Array>;
14
- destroy: () => void;
15
- }
@@ -1,33 +0,0 @@
1
- import { OnMessageFormatResult } from '../../protos/protoEvent';
2
- export type CwsCodecWorkerRequest = {
3
- id: number;
4
- action: 'decode';
5
- data: {
6
- buffer: ArrayBuffer;
7
- };
8
- } | {
9
- id: number;
10
- action: 'gzipCompress';
11
- data: {
12
- buffer: ArrayBuffer;
13
- };
14
- } | {
15
- id: number;
16
- action: 'destroy';
17
- data?: Record<string, never>;
18
- };
19
- export type CwsCodecWorkerResponse = {
20
- id: number;
21
- ok: true;
22
- kind: 'decode';
23
- result: OnMessageFormatResult;
24
- } | {
25
- id: number;
26
- ok: true;
27
- kind: 'gzipCompress';
28
- buffer: ArrayBuffer;
29
- } | {
30
- id: number;
31
- ok: false;
32
- error: string;
33
- };