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,9 +1,9 @@
1
1
  import { GenEnum, GenFile, GenMessage } from '@bufbuild/protobuf/codegenv2';
2
2
  import { Message } from '@bufbuild/protobuf';
3
3
  /**
4
- * Describes the file modules/Room.proto.
4
+ * Describes the file Room.proto.
5
5
  */
6
- export declare const file_modules_Room: GenFile;
6
+ export declare const file_Room: GenFile;
7
7
  /**
8
8
  * Room user info
9
9
  *
@@ -428,6 +428,12 @@ export type SubscribeReq = Message<"com.quick.voice.proto.SubscribeReq"> & {
428
428
  * @generated from field: optional string session = 2;
429
429
  */
430
430
  session?: string;
431
+ /**
432
+ * 2026.3.30 add
433
+ *
434
+ * @generated from field: optional bool selfCheck = 3;
435
+ */
436
+ selfCheck?: boolean;
431
437
  };
432
438
  /**
433
439
  * Describes the message com.quick.voice.proto.SubscribeReq.
@@ -1023,6 +1029,10 @@ export type ChannelPublishReq = Message<"com.quick.voice.proto.ChannelPublishReq
1023
1029
  * @generated from field: repeated com.quick.voice.proto.DataChannel channels = 1;
1024
1030
  */
1025
1031
  channels: DataChannel[];
1032
+ /**
1033
+ * @generated from field: optional string session = 2;
1034
+ */
1035
+ session?: string;
1026
1036
  };
1027
1037
  /**
1028
1038
  * Describes the message com.quick.voice.proto.ChannelPublishReq.
@@ -1053,6 +1063,10 @@ export type ChannelSubscribeReq = Message<"com.quick.voice.proto.ChannelSubscrib
1053
1063
  * @generated from field: repeated com.quick.voice.proto.UserChannel users = 1;
1054
1064
  */
1055
1065
  users: UserChannel[];
1066
+ /**
1067
+ * @generated from field: optional string session = 2;
1068
+ */
1069
+ session?: string;
1056
1070
  };
1057
1071
  /**
1058
1072
  * Describes the message com.quick.voice.proto.ChannelSubscribeReq.
@@ -1073,70 +1087,6 @@ export type ChannelSubscribeRsq = Message<"com.quick.voice.proto.ChannelSubscrib
1073
1087
  * Use `create(ChannelSubscribeRsqSchema)` to create a new message.
1074
1088
  */
1075
1089
  export declare const ChannelSubscribeRsqSchema: GenMessage<ChannelSubscribeRsq>;
1076
- /**
1077
- * @generated from message com.quick.voice.proto.DataChannelData
1078
- */
1079
- export type DataChannelData = Message<"com.quick.voice.proto.DataChannelData"> & {
1080
- /**
1081
- * @generated from field: string userId = 1;
1082
- */
1083
- userId: string;
1084
- /**
1085
- * @generated from field: com.quick.voice.proto.DataChannelType type = 2;
1086
- */
1087
- type: DataChannelType;
1088
- /**
1089
- * backAuido
1090
- *
1091
- * @generated from field: optional com.quick.voice.proto.DataChannelAudioData audioData = 3;
1092
- */
1093
- audioData?: DataChannelAudioData;
1094
- };
1095
- /**
1096
- * Describes the message com.quick.voice.proto.DataChannelData.
1097
- * Use `create(DataChannelDataSchema)` to create a new message.
1098
- */
1099
- export declare const DataChannelDataSchema: GenMessage<DataChannelData>;
1100
- /**
1101
- * @generated from message com.quick.voice.proto.DataChannelAudioData
1102
- */
1103
- export type DataChannelAudioData = Message<"com.quick.voice.proto.DataChannelAudioData"> & {
1104
- /**
1105
- * @generated from field: bytes data = 1;
1106
- */
1107
- data: Uint8Array;
1108
- /**
1109
- * @generated from field: com.quick.voice.proto.DataChannelAudioFormat format = 2;
1110
- */
1111
- format?: DataChannelAudioFormat;
1112
- /**
1113
- * @generated from field: optional int64 time = 3;
1114
- */
1115
- time?: bigint;
1116
- };
1117
- /**
1118
- * Describes the message com.quick.voice.proto.DataChannelAudioData.
1119
- * Use `create(DataChannelAudioDataSchema)` to create a new message.
1120
- */
1121
- export declare const DataChannelAudioDataSchema: GenMessage<DataChannelAudioData>;
1122
- /**
1123
- * @generated from message com.quick.voice.proto.DataChannelAudioFormat
1124
- */
1125
- export type DataChannelAudioFormat = Message<"com.quick.voice.proto.DataChannelAudioFormat"> & {
1126
- /**
1127
- * @generated from field: double sampleRate = 1;
1128
- */
1129
- sampleRate: number;
1130
- /**
1131
- * @generated from field: int32 channels = 2;
1132
- */
1133
- channels: number;
1134
- };
1135
- /**
1136
- * Describes the message com.quick.voice.proto.DataChannelAudioFormat.
1137
- * Use `create(DataChannelAudioFormatSchema)` to create a new message.
1138
- */
1139
- export declare const DataChannelAudioFormatSchema: GenMessage<DataChannelAudioFormat>;
1140
1090
  /**
1141
1091
  * confirm consumer msg
1142
1092
  *
@@ -1770,17 +1720,6 @@ export type IceServer = Message<"com.quick.voice.proto.IceServer"> & {
1770
1720
  * Use `create(IceServerSchema)` to create a new message.
1771
1721
  */
1772
1722
  export declare const IceServerSchema: GenMessage<IceServer>;
1773
- /**
1774
- * event: genTurnAddress request
1775
- *
1776
- * @generated from message com.quick.voice.proto.TurnUrlsReq
1777
- */
1778
- export type TurnUrlsReq = Message<"com.quick.voice.proto.TurnUrlsReq"> & {};
1779
- /**
1780
- * Describes the message com.quick.voice.proto.TurnUrlsReq.
1781
- * Use `create(TurnUrlsReqSchema)` to create a new message.
1782
- */
1783
- export declare const TurnUrlsReqSchema: GenMessage<TurnUrlsReq>;
1784
1723
  /**
1785
1724
  * @generated from message com.quick.voice.proto.TurnUrlsResponse
1786
1725
  */
@@ -1964,19 +1903,6 @@ export declare enum CountMethods {
1964
1903
  * Describes the enum com.quick.voice.proto.CountMethods.
1965
1904
  */
1966
1905
  export declare const CountMethodsSchema: GenEnum<CountMethods>;
1967
- /**
1968
- * @generated from enum com.quick.voice.proto.DataChannelType
1969
- */
1970
- export declare enum DataChannelType {
1971
- /**
1972
- * @generated from enum value: backAuido = 0;
1973
- */
1974
- backAuido = 0
1975
- }
1976
- /**
1977
- * Describes the enum com.quick.voice.proto.DataChannelType.
1978
- */
1979
- export declare const DataChannelTypeSchema: GenEnum<DataChannelType>;
1980
1906
  /**
1981
1907
  * @generated from enum com.quick.voice.proto.NatType
1982
1908
  */
@@ -0,0 +1,154 @@
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 Rtc.proto.
6
+ */
7
+ export declare const file_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
+ * @generated from field: com.quick.voice.proto.TrackType type = 4;
26
+ */
27
+ type: TrackType;
28
+ /**
29
+ * @generated from field: bool isActive = 5;
30
+ */
31
+ isActive: boolean;
32
+ };
33
+ /**
34
+ * Describes the message com.quick.voice.proto.RtcTrack.
35
+ * Use `create(RtcTrackSchema)` to create a new message.
36
+ */
37
+ export declare const RtcTrackSchema: GenMessage<RtcTrack>;
38
+ /**
39
+ * @generated from message com.quick.voice.proto.UpdateTrackState
40
+ */
41
+ export type UpdateTrackState = Message<"com.quick.voice.proto.UpdateTrackState"> & {
42
+ /**
43
+ * @generated from field: string roomId = 1;
44
+ */
45
+ roomId: string;
46
+ /**
47
+ * @generated from field: repeated com.quick.voice.proto.RtcTrack tracks = 2;
48
+ */
49
+ tracks: RtcTrack[];
50
+ };
51
+ /**
52
+ * Describes the message com.quick.voice.proto.UpdateTrackState.
53
+ * Use `create(UpdateTrackStateSchema)` to create a new message.
54
+ */
55
+ export declare const UpdateTrackStateSchema: GenMessage<UpdateTrackState>;
56
+ /**
57
+ * @generated from message com.quick.voice.proto.RtcStatsData
58
+ */
59
+ export type RtcStatsData = Message<"com.quick.voice.proto.RtcStatsData"> & {
60
+ /**
61
+ * @generated from field: string userId = 1;
62
+ */
63
+ userId: string;
64
+ /**
65
+ * @generated from field: int64 statsTime = 2;
66
+ */
67
+ statsTime: bigint;
68
+ /**
69
+ * @generated from field: double roundTripTime = 3;
70
+ */
71
+ roundTripTime: number;
72
+ /**
73
+ * @generated from field: double upQualityScore = 4;
74
+ */
75
+ upQualityScore: number;
76
+ /**
77
+ * @generated from field: double downQualityScore = 5;
78
+ */
79
+ downQualityScore: number;
80
+ /**
81
+ * @generated from field: repeated com.quick.voice.proto.TrackStatsData stats = 6;
82
+ */
83
+ stats: TrackStatsData[];
84
+ };
85
+ /**
86
+ * Describes the message com.quick.voice.proto.RtcStatsData.
87
+ * Use `create(RtcStatsDataSchema)` to create a new message.
88
+ */
89
+ export declare const RtcStatsDataSchema: GenMessage<RtcStatsData>;
90
+ /**
91
+ * @generated from message com.quick.voice.proto.TrackStatsData
92
+ */
93
+ export type TrackStatsData = Message<"com.quick.voice.proto.TrackStatsData"> & {
94
+ /**
95
+ * @generated from field: com.quick.voice.proto.TrackType type = 1;
96
+ */
97
+ type: TrackType;
98
+ /**
99
+ * @generated from field: double bandwidth = 2;
100
+ */
101
+ bandwidth: number;
102
+ /**
103
+ * @generated from field: double jitter = 3;
104
+ */
105
+ jitter: number;
106
+ /**
107
+ * @generated from field: int64 packetsLost = 4;
108
+ */
109
+ packetsLost: bigint;
110
+ /**
111
+ * @generated from field: double packetsLostRate = 5;
112
+ */
113
+ packetsLostRate: number;
114
+ };
115
+ /**
116
+ * Describes the message com.quick.voice.proto.TrackStatsData.
117
+ * Use `create(TrackStatsDataSchema)` to create a new message.
118
+ */
119
+ export declare const TrackStatsDataSchema: GenMessage<TrackStatsData>;
120
+ /**
121
+ * @generated from message com.quick.voice.proto.RtcStatsNotify
122
+ */
123
+ export type RtcStatsNotify = Message<"com.quick.voice.proto.RtcStatsNotify"> & {
124
+ /**
125
+ * @generated from field: string roomId = 1;
126
+ */
127
+ roomId: string;
128
+ /**
129
+ * @generated from field: repeated com.quick.voice.proto.RtcStatsData stats = 2;
130
+ */
131
+ stats: RtcStatsData[];
132
+ };
133
+ /**
134
+ * Describes the message com.quick.voice.proto.RtcStatsNotify.
135
+ * Use `create(RtcStatsNotifySchema)` to create a new message.
136
+ */
137
+ export declare const RtcStatsNotifySchema: GenMessage<RtcStatsNotify>;
138
+ /**
139
+ * @generated from enum com.quick.voice.proto.RtcEvent
140
+ */
141
+ export declare enum RtcEvent {
142
+ /**
143
+ * @generated from enum value: UpdateTrackActive = 0;
144
+ */
145
+ UpdateTrackActive = 0,
146
+ /**
147
+ * @generated from enum value: RtcStats = 1;
148
+ */
149
+ RtcStats = 1
150
+ }
151
+ /**
152
+ * Describes the enum com.quick.voice.proto.RtcEvent.
153
+ */
154
+ export declare const RtcEventSchema: GenEnum<RtcEvent>;
@@ -1,4 +1,3 @@
1
- export * from './gen/modules/BaseData_pb';
2
- export * from './gen/modules/Room_pb';
3
- export * from './gen/modules/Rtc_pb';
4
- export * from './protoCodec';
1
+ export * from './gen/BaseData_pb';
2
+ export * from './gen/Room_pb';
3
+ export * from './gen/Rtc_pb';
@@ -1,21 +1,59 @@
1
1
  import { MessageInitShape } from '@bufbuild/protobuf';
2
- import { K_eventName } from '../enums/eventName';
3
- import { K_notifyName } from '../enums/notifyName';
4
- import { CommonRspDecoded } from './protoCodec';
5
- import * as Room from './gen/modules/Room_pb';
6
- import * as Rtc from './gen/modules/Rtc_pb';
7
- /**
8
- * onMessageFormat 按 event 解析后的 data 类型(与 switch 中 fromBinary 一致)
9
- */
10
- export type OnMessageDataMap = {
2
+ import { K_eventName, K_notifyName } from '../enums';
3
+ import * as Room from './gen/Room_pb';
4
+ import * as Rtc from './gen/Rtc_pb';
5
+ type SendMessageDataMap = {
6
+ heartbeat: MessageInitShape<typeof Room.ReportTrafficUsageSchema>;
7
+ heartbeatEx: MessageInitShape<typeof Room.ReportTrafficUsageSchema>;
8
+ ackMsg: MessageInitShape<typeof Room.AckMsgReqSchema>;
9
+ reportNetwork: MessageInitShape<typeof Room.ReportNetInfoSchema>;
10
+ connectCF: MessageInitShape<typeof Room.ConnectCFReqSchema>;
11
+ genTurnAddress: MessageInitShape<typeof Room.TurnUrlsResponseSchema>;
12
+ publish: MessageInitShape<typeof Room.PublishReqSchema>;
13
+ joinRoom: MessageInitShape<typeof Room.JoinReqSchema>;
14
+ joinRoomEx: MessageInitShape<typeof Room.JoinReqSchema>;
15
+ pubNotify: MessageInitShape<typeof Room.PublishNotifySchema>;
16
+ subscribe: MessageInitShape<typeof Room.SubscribeReqSchema>;
17
+ pubChannel: MessageInitShape<typeof Room.ChannelPublishReqSchema>;
18
+ closeChannel: MessageInitShape<typeof Room.ChannelSubscribeReqSchema>;
19
+ subChannel: MessageInitShape<typeof Room.ChannelSubscribeReqSchema>;
20
+ renegotiate: MessageInitShape<typeof Room.RenegotiateReqSchema>;
21
+ closeTrack: MessageInitShape<typeof Room.CloseTrackReqSchema>;
22
+ preventUsersBehavior: MessageInitShape<typeof Room.PreventUsersBehaviorReqSchema>;
23
+ networkQualityChange: MessageInitShape<typeof Room.NetQualityChangeSchema>;
24
+ updateCall: MessageInitShape<typeof Room.UpdateCallSchema>;
25
+ toggleRoomSpeechLang: MessageInitShape<typeof Room.AiLangSettingSchema>;
26
+ syncRoomInfo: MessageInitShape<typeof Room.SyncRoomInfoReqSchema>;
27
+ updateSimulcast: MessageInitShape<typeof Room.SubscribeReqSchema>;
28
+ updateRoomToken: MessageInitShape<typeof Room.UpdateTokenReqSchema>;
29
+ offer: MessageInitShape<typeof Room.SdpConsultSchema>;
30
+ answer: MessageInitShape<typeof Room.SdpConsultSchema>;
31
+ candidate: MessageInitShape<typeof Room.CandidatesSchema>;
32
+ reportP2PConnectEx: MessageInitShape<typeof Room.ReportP2PExReqSchema>;
33
+ quitRoom: MessageInitShape<typeof Room.QuitReqSchema>;
34
+ quitRoomEx: MessageInitShape<typeof Room.QuitReqSchema>;
35
+ debugger: Record<string, never>;
36
+ ai: Record<string, never>;
37
+ UpdateTrackActive: MessageInitShape<typeof Rtc.UpdateTrackStateSchema>;
38
+ RtcStats: MessageInitShape<typeof Rtc.RtcStatsDataSchema>;
39
+ rtcStats: MessageInitShape<typeof Rtc.RtcStatsDataSchema>;
40
+ };
41
+ type EventDataReqs = {
42
+ [K in K_eventName]: K extends keyof SendMessageDataMap ? SendMessageDataMap[K] : unknown;
43
+ };
44
+ type OnMessageDataMap = {
11
45
  connectCF: Room.ConnectCFRsp;
12
46
  genTurnAddress: Room.TurnUrlsResponse;
13
47
  publish: Room.PublishRsp;
48
+ pubChannel: Room.ChannelPublishRsq;
49
+ closeChannel: Room.ChannelSubscribeRsq;
50
+ subChannel: Room.ChannelSubscribeRsq;
14
51
  joinRoom: Room.JoinRsp;
15
52
  joinRoomEx: Room.JoinRsp;
16
53
  subscribe: Room.SubscribeRsp;
17
54
  closeTrack: Room.CloseTrackRsp;
18
55
  syncRoomInfo: Room.SyncRoomInfoRsp;
56
+ onDataChannelPublish: Room.UserChannel;
19
57
  onJoinRoom: Room.JoinNotify;
20
58
  onJoinRoomBatch: Room.JoinBatchNotify;
21
59
  onPublish: Room.PublishNotify;
@@ -38,96 +76,22 @@ export type OnMessageDataMap = {
38
76
  onQuitRoom: Room.QuitNotify;
39
77
  onQuitRoomBatch: Room.QuitBatchNotify;
40
78
  onDestroyRoom: Room.QuitNotify;
41
- /** JSON.parse,结构由服务端约定 */
42
79
  debugger: unknown;
43
80
  ai: unknown;
44
81
  UpdateTrackActive: Rtc.UpdateTrackState;
82
+ RtcStatsData: Rtc.RtcStatsData;
83
+ rtcStatsData: Rtc.RtcStatsData;
84
+ onRtcStats: Rtc.RtcStatsNotify;
45
85
  };
46
- /**
47
- * 请求事件对应的响应 data(与 onMessageFormat 中可解析的 event 对齐;未单独解析的为 unknown)
48
- */
49
- export type EventDataRsp = {
86
+ type EventDataRsps = {
50
87
  [K in K_eventName]: K extends keyof OnMessageDataMap ? OnMessageDataMap[K] : unknown;
51
88
  };
52
- /** 所有 onMessageFormat 可解析出的业务 data 的联合(用于通知回调) */
53
- export type OnMessageDataUnion = OnMessageDataMap[keyof OnMessageDataMap];
54
- /** 广播通知:与 cws 内 filterKeys(result, ['code','data','desc']) 一致;data 为联合类型,可按 event 自行收窄 */
55
- export type CwsNotifyPayloadUnion = {
56
- code: number;
57
- desc: string;
58
- data: OnMessageDataUnion | undefined;
89
+ type EventDataNotifys = {
90
+ [K in K_notifyName]: K extends keyof OnMessageDataMap ? OnMessageDataMap[K] : unknown;
59
91
  };
60
- /** 单个通知事件的回调 payload(与 filterKeys(result, ['code','data','desc']) 一致) */
61
- export type CwsNotifyPayloadFor<K extends K_notifyName> = {
92
+ export interface MessageNotifys<T extends K_notifyName> {
62
93
  code: number;
63
94
  desc: string;
64
- data: K extends keyof OnMessageDataMap ? OnMessageDataMap[K] : undefined;
65
- };
66
- /**
67
- * cws 广播回调:按事件名推断 payload,例如 `on.onJoinRoom = (e) => e.data` 中 `data` 为 `JoinNotify`
68
- */
69
- export type CallsWebSocketOn = {
70
- [K in K_notifyName]?: (payload: CwsNotifyPayloadFor<K>) => void;
71
- } & {
72
- state?: (state: 'connecting' | 'reconnecting' | 'connected' | 'closed') => void;
73
- log?: (e: unknown) => void;
74
- };
75
- /**
76
- * 仅用于类型推断:传入部分 on 回调,获得与事件名对齐的 payload 类型(无需写 `as`)
77
- * @example
78
- * ```ts
79
- * const handlers = defineCwsOn({
80
- * onJoinRoom: (e) => e.data.roomId,
81
- * onPublish: (e) => e.data.user,
82
- * })
83
- * cws.on = { ...cws.on, ...handlers }
84
- * ```
85
- */
86
- export declare function defineCwsOn<const T extends Partial<CallsWebSocketOn>>(handlers: T): T;
87
- /** 解析后 data 为业务消息体,不再与 CommonRsp 的 bytes data 共用字段 */
88
- export type OnMessageFormatResult<E extends string = string> = Omit<CommonRspDecoded, 'data'> & {
89
- timeStr: string;
90
- data_remote: Uint8Array;
91
- data: E extends keyof OnMessageDataMap ? OnMessageDataMap[E] : undefined;
92
- remoteTime: number;
93
- remoteTimeStr: string;
94
- };
95
- /**
96
- * 各 event 的 send({ data }) 类型:与对应 Req 的 MessageInitShape 一致;sendMessageFormat 内 enc(schema, create(...))
97
- */
98
- export type EventDataReqs = {
99
- heartbeat: MessageInitShape<typeof Room.ReportTrafficUsageSchema>;
100
- /** 慢心跳可无字段 */
101
- heartbeatEx: MessageInitShape<typeof Room.ReportTrafficUsageSchema>;
102
- ackMsg: MessageInitShape<typeof Room.AckMsgReqSchema>;
103
- reportNetwork: MessageInitShape<typeof Room.ReportNetInfoSchema>;
104
- connectCF: MessageInitShape<typeof Room.ConnectCFReqSchema>;
105
- genTurnAddress: MessageInitShape<typeof Room.TurnUrlsReqSchema>;
106
- publish: MessageInitShape<typeof Room.PublishReqSchema>;
107
- joinRoom: MessageInitShape<typeof Room.JoinReqSchema>;
108
- joinRoomEx: MessageInitShape<typeof Room.JoinReqSchema>;
109
- pubNotify: MessageInitShape<typeof Room.PublishNotifySchema>;
110
- subscribe: MessageInitShape<typeof Room.SubscribeReqSchema>;
111
- renegotiate: MessageInitShape<typeof Room.RenegotiateReqSchema>;
112
- closeTrack: MessageInitShape<typeof Room.CloseTrackReqSchema>;
113
- preventUsersBehavior: MessageInitShape<typeof Room.PreventUsersBehaviorReqSchema>;
114
- networkQualityChange: MessageInitShape<typeof Room.NetQualityChangeSchema>;
115
- updateCall: MessageInitShape<typeof Room.UpdateCallSchema>;
116
- toggleRoomSpeechLang: MessageInitShape<typeof Room.AiLangSettingSchema>;
117
- syncRoomInfo: MessageInitShape<typeof Room.SyncRoomInfoReqSchema>;
118
- updateSimulcast: MessageInitShape<typeof Room.SubscribeReqSchema>;
119
- updateRoomToken: MessageInitShape<typeof Room.UpdateTokenReqSchema>;
120
- offer: MessageInitShape<typeof Room.SdpConsultSchema>;
121
- answer: MessageInitShape<typeof Room.SdpConsultSchema>;
122
- candidate: MessageInitShape<typeof Room.CandidatesSchema>;
123
- reportP2PConnectEx: MessageInitShape<typeof Room.ReportP2PExReqSchema>;
124
- quitRoom: MessageInitShape<typeof Room.QuitReqSchema>;
125
- quitRoomEx: MessageInitShape<typeof Room.QuitReqSchema>;
126
- debugger: Record<string, never>;
127
- ai: Record<string, never>;
128
- UpdateTrackActive: MessageInitShape<typeof Rtc.UpdateTrackStateSchema>;
129
- };
130
- export interface MessageReq<T extends K_eventName> {
131
95
  /**
132
96
  * 事件名称
133
97
  */
@@ -135,35 +99,29 @@ export interface MessageReq<T extends K_eventName> {
135
99
  /**
136
100
  * 事件数据
137
101
  */
138
- data: EventDataReqs[T];
102
+ data: EventDataNotifys[T];
139
103
  /**
140
104
  * 请求时间戳
141
105
  */
142
- time?: number;
143
- /**
144
- * 格式化时间戳
145
- */
146
- timeStr?: string;
106
+ time: number;
147
107
  /**
148
108
  * 唯一标识
149
109
  */
150
- sn?: number;
110
+ sn: number;
151
111
  /**
152
112
  * 是否压缩数据
153
113
  */
154
- compress?: boolean;
114
+ compress: boolean;
155
115
  /**
156
116
  * 有效时长
157
117
  */
158
- valid?: number;
118
+ valid: number;
159
119
  /**
160
120
  * 接口版本
161
121
  */
162
- version?: number;
122
+ version: number;
163
123
  }
164
- export interface MessageRsp<T extends K_eventName> {
165
- code: number;
166
- desc: string;
124
+ export interface MessageReq<T extends K_eventName> {
167
125
  /**
168
126
  * 事件名称
169
127
  */
@@ -171,15 +129,11 @@ export interface MessageRsp<T extends K_eventName> {
171
129
  /**
172
130
  * 事件数据
173
131
  */
174
- data: EventDataRsp[T];
132
+ data: EventDataReqs[T];
175
133
  /**
176
134
  * 请求时间戳
177
135
  */
178
136
  time: number;
179
- /**
180
- * 格式化时间戳
181
- */
182
- timeStr: string;
183
137
  /**
184
138
  * 唯一标识
185
139
  */
@@ -197,25 +151,21 @@ export interface MessageRsp<T extends K_eventName> {
197
151
  */
198
152
  version: number;
199
153
  }
200
- /** cws 请求-响应实际传递的字段(与 send / resolve 一致) */
201
- export type MessageRspCore<T extends K_eventName> = Pick<MessageRsp<T>, 'event' | 'sn' | 'data' | 'code' | 'desc'>;
202
- export interface SendMessageFormat<T extends K_eventName> {
154
+ export interface MessageRsp<T extends K_eventName> {
155
+ code: number;
156
+ desc: string;
203
157
  /**
204
158
  * 事件名称
205
159
  */
206
160
  event: T;
207
161
  /**
208
- * 原始事件数据
162
+ * 事件数据
209
163
  */
210
- data: EventDataReqs[T];
164
+ data: EventDataRsps[T];
211
165
  /**
212
166
  * 请求时间戳
213
167
  */
214
168
  time: number;
215
- /**
216
- * 格式化时间戳
217
- */
218
- timeStr?: string;
219
169
  /**
220
170
  * 唯一标识
221
171
  */
@@ -233,37 +183,17 @@ export interface SendMessageFormat<T extends K_eventName> {
233
183
  */
234
184
  version: number;
235
185
  }
236
- export declare const sendMessageFormat: <T extends K_eventName>(message: SendMessageFormat<T>) => {
237
- timeStr: string;
238
- data_original: EventDataReqs[T];
239
- data: Uint8Array<ArrayBufferLike>;
240
- /**
241
- * 事件名称
242
- */
243
- event: T;
244
- /**
245
- * 请求时间戳
246
- */
247
- time: number;
248
- /**
249
- * 唯一标识
250
- */
186
+ export declare const encMsg: <T extends K_eventName>(message: MessageReq<T>) => Uint8Array<ArrayBuffer>;
187
+ export declare const decMsg: (buffer: ArrayBuffer) => {
188
+ event: string;
189
+ data: any;
251
190
  sn: number;
252
- /**
253
- * 是否压缩数据
254
- */
191
+ time: number;
192
+ data_remote: Uint8Array<ArrayBufferLike>;
193
+ code: number;
194
+ desc: string;
255
195
  compress: boolean;
256
- /**
257
- * 有效时长
258
- */
259
196
  valid: number;
260
- /**
261
- * 接口版本
262
- */
263
197
  version: number;
264
198
  };
265
- export declare function onMessageFormat<E extends string = string>(message: CommonRspDecoded & {
266
- event: E;
267
- }): OnMessageFormatResult<E>;
268
- export declare const obj2pb: (message: Record<string, unknown>) => Uint8Array<ArrayBufferLike>;
269
- export declare const pb2obj: (uint8Array: Uint8Array) => CommonRspDecoded;
199
+ export {};
@@ -1,5 +1,5 @@
1
1
  export declare const isMobile: () => boolean;
2
- export declare const getNetworkQuality: (lostRate: number, roundTripTime: number, jitter: number) => 2 | 1 | 3 | 4 | 5;
2
+ export declare const getNetworkQuality: (lostRate: number, roundTripTime: number, jitter: number, isLocal?: boolean) => number;
3
3
  export declare const availableWeight: number[];
4
4
  export declare const estimateDataByResolution: (width: number, height: number) => number;
5
5
  export declare const sortByMimeTypes: (codecs: RTCRtpCodec[], preferredOrder: string[]) => RTCRtpCodec[];
@@ -1,4 +1,3 @@
1
- import { NotifyEmitPayloadUnion, QuickvoNotify } from './base/modules/notifyPayloadMap';
2
1
  import { K_mediaType } from './enums/mediaType';
3
2
  import { K_callStrategy } from './enums/callStrategy';
4
3
  export interface QuickOptions {
@@ -121,17 +120,6 @@ export interface UserTrack {
121
120
  */
122
121
  enabled: boolean;
123
122
  }
124
- /**
125
- * notifys.emit 派发至 callback 的载荷联合(按 event 收窄请用 `NotifyEmitPayloadFor<E>`)
126
- */
127
- export type NotifyEmitPayload = NotifyEmitPayloadUnion;
128
- /**
129
- * 广播(event 与 callback 参数类型联动,见 QuickvoNotify)
130
- */
131
- export type Notify = QuickvoNotify;
132
- /** QuickVO 通知事件名(`enum_notifyName` + SDK 内部如 onLog、onRoomState) */
133
- export type { K_quickvoNotifyName, NotifyEmitPayloadFor, NotifyPayloadMap } from './base/modules/notifyPayloadMap';
134
- export { defineQuickvoNotify } from './base/modules/notifyPayloadMap';
135
123
  /**
136
124
  * 房间用户
137
125
  */
@@ -0,0 +1,8 @@
1
+ import { On } from './types';
2
+ export declare class WorkerCore {
3
+ on: On;
4
+ init: () => void;
5
+ encode: (data: Record<string, any>) => void;
6
+ decode: (data: ArrayBuffer) => void;
7
+ destroy: () => void;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { On } from './types';
2
+ export declare class WorkerProtos {
3
+ private worker;
4
+ on: On;
5
+ constructor();
6
+ init: () => void;
7
+ encode: (data: Record<string, any>) => void;
8
+ decode: (data: ArrayBuffer) => void;
9
+ destroy: () => void;
10
+ }
@@ -0,0 +1,8 @@
1
+ export interface On {
2
+ encode?: (result: {
3
+ event: string;
4
+ sn: number;
5
+ msg: Uint8Array<ArrayBuffer>;
6
+ }) => void;
7
+ decode?: (result: Record<string, any>) => void;
8
+ }