quickvo-sdk-js 1.6.55 → 1.6.56
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/package.json +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -26189
- package/dist/index.umd.cjs +0 -4
- package/dist/src/QuickVO.d.ts +0 -86
- package/dist/src/action/ActionBase.d.ts +0 -10
- package/dist/src/action/ActionP2P.d.ts +0 -14
- package/dist/src/action/ActionSFU.d.ts +0 -133
- package/dist/src/base/Base.d.ts +0 -59
- package/dist/src/base/modules/AnimationFrame.d.ts +0 -22
- package/dist/src/base/modules/Config.d.ts +0 -130
- package/dist/src/base/modules/LocalMedias.d.ts +0 -96
- package/dist/src/base/modules/Notifys.d.ts +0 -41
- package/dist/src/base/modules/Peer.d.ts +0 -48
- package/dist/src/base/modules/PrResolves.d.ts +0 -23
- package/dist/src/base/modules/StreamRecorder.d.ts +0 -40
- package/dist/src/base/modules/Traffic.d.ts +0 -21
- package/dist/src/base/modules/cws/CallsWebSocket.d.ts +0 -48
- package/dist/src/base/modules/cws/CallsWebSocketEvent.d.ts +0 -36
- package/dist/src/base/modules/cws/PrWebSocket.d.ts +0 -49
- package/dist/src/base/modules/cws/filterData.d.ts +0 -17
- package/dist/src/base/modules/users/Users.d.ts +0 -203
- package/dist/src/base/modules/users/modules/LocalTrackAnalysis.d.ts +0 -20
- package/dist/src/base/modules/users/modules/LocalUser.d.ts +0 -33
- package/dist/src/base/modules/users/modules/RemotePeerTrackAnalysis.d.ts +0 -20
- package/dist/src/base/modules/users/modules/RemoteUser.d.ts +0 -75
- package/dist/src/base/modules/users/modules/RemoteUserP2P.d.ts +0 -87
- package/dist/src/base/modules/users/modules/UserBase.d.ts +0 -173
- package/dist/src/enums/callStrategy.d.ts +0 -14
- package/dist/src/enums/eventName.d.ts +0 -38
- package/dist/src/enums/index.d.ts +0 -7
- package/dist/src/enums/mediaType.d.ts +0 -15
- package/dist/src/enums/notifyName.d.ts +0 -30
- package/dist/src/enums/quality.d.ts +0 -17
- package/dist/src/enums/roomState.d.ts +0 -17
- package/dist/src/enums/trackType.d.ts +0 -15
- package/dist/src/index.d.ts +0 -3
- package/dist/src/protos/compiled.d.ts +0 -7175
- package/dist/src/protos/index.d.ts +0 -1
- package/dist/src/protos/protoEvent.d.ts +0 -196
- package/dist/src/tools.d.ts +0 -5
- package/dist/src/types.d.ts +0 -278
package/dist/src/QuickVO.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { QuickOptions } from './types';
|
|
2
|
-
export declare class QuickVO {
|
|
3
|
-
private _base;
|
|
4
|
-
private _ACTION_BASE;
|
|
5
|
-
private _ACTION_SFU;
|
|
6
|
-
private _ACTION_P2P;
|
|
7
|
-
constructor(options: QuickOptions);
|
|
8
|
-
recorder: import('./base/modules/StreamRecorder').StreamRecorder;
|
|
9
|
-
use: ({ rnnoise }: {
|
|
10
|
-
rnnoise?: import('./base/Base').PrRnnoise;
|
|
11
|
-
}) => void;
|
|
12
|
-
setCallStrategy: (callStrategy: import('./enums').K_callStrategy, mediaTypes?: import('./enums').K_mediaType[]) => Promise<void>;
|
|
13
|
-
addNotify: (notify: {
|
|
14
|
-
sn?: string;
|
|
15
|
-
event: "onJoinRoom" | "onQuitRoom" | "onPublish" | "onBeforeTokenExpire" | "onTokenExpired" | "onDestroyRoom" | "onCDNPlayUrlAdd" | "onRoomUserSpeech" | "onLog" | "onRoomUsers" | "onRoomNetwork" | "onDevicechange" | "onPeerState" | "onRoomState";
|
|
16
|
-
callback?: (e: any) => void;
|
|
17
|
-
}) => string;
|
|
18
|
-
setOptions: (options: Partial<QuickOptions & import('./types').RoomOptions>) => void;
|
|
19
|
-
getLocalStream: (mediaType: import('./enums').K_mediaType) => MediaStream;
|
|
20
|
-
getLocalStreams: () => {
|
|
21
|
-
mc_audio: MediaStream;
|
|
22
|
-
mc_video: MediaStream;
|
|
23
|
-
ss_video: MediaStream;
|
|
24
|
-
ss_audio: MediaStream;
|
|
25
|
-
};
|
|
26
|
-
setActiveNoise: (mediaType: import('./enums').K_mediaType, state: boolean) => void;
|
|
27
|
-
getUserContent: (userId?: string) => import('./base/modules/users/modules/LocalUser').LocalUser | import('./base/modules/users/modules/RemoteUser').RemoteUser | undefined;
|
|
28
|
-
getUserStream: (userId: string, mediaType: import('./enums').K_mediaType) => MediaStream | undefined;
|
|
29
|
-
getVolume: (userId: string, mediaType: import('./enums').K_mediaType) => number | undefined;
|
|
30
|
-
getMaxVolumeUser: () => {
|
|
31
|
-
id: string;
|
|
32
|
-
volume: number;
|
|
33
|
-
} | undefined;
|
|
34
|
-
setInputVolume: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => void;
|
|
35
|
-
setEnhanceGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
|
|
36
|
-
setSpeakerVolume: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => void;
|
|
37
|
-
getUserAudioMediaStreamContext: (userId: string, mediaType: import('./enums').K_mediaType) => import('pr-audio-stream').PrAudioStream | undefined;
|
|
38
|
-
playBgs: (userId: string, mediaType: import('./enums').K_mediaType, buffer: AudioBuffer | null) => Promise<void>;
|
|
39
|
-
changBgsMix: (userId: string, mediaType: import('./enums').K_mediaType, mix: boolean) => Promise<void>;
|
|
40
|
-
stopBgs: (userId: string, mediaType: import('./enums').K_mediaType) => Promise<void>;
|
|
41
|
-
setBgsGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
|
|
42
|
-
playBgm: (userId: string, mediaType: import('./enums').K_mediaType, buffer: AudioBuffer | null) => Promise<void>;
|
|
43
|
-
changBgmMix: (userId: string, mediaType: import('./enums').K_mediaType, mix: boolean) => Promise<void>;
|
|
44
|
-
stopBgm: (userId: string, mediaType: import('./enums').K_mediaType) => Promise<void>;
|
|
45
|
-
setBgmGain: (userId: string, mediaType: import('./enums').K_mediaType, gain: number) => Promise<void>;
|
|
46
|
-
getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<import('./types').DeviceInfo[]>;
|
|
47
|
-
getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
|
|
48
|
-
getMediaDevicesErrInfo: () => Promise<{
|
|
49
|
-
mc_audio: string;
|
|
50
|
-
mc_video: string;
|
|
51
|
-
}>;
|
|
52
|
-
setLocalStream: (mediaTypes: import('./enums').K_mediaType[], active: boolean) => Promise<unknown>;
|
|
53
|
-
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<unknown>;
|
|
54
|
-
setMediaTrackConstraints: (mediaType: import('./enums').K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
|
|
55
|
-
earlyConnect: (mediaTypes?: import('./enums').K_mediaType[]) => Promise<unknown>;
|
|
56
|
-
joinRoom: (roomOptions: import('./types').RoomOptions) => Promise<unknown>;
|
|
57
|
-
publish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<boolean>;
|
|
58
|
-
stopPublish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<boolean>;
|
|
59
|
-
pauseTracks: (mediaTypes: import('./enums').K_mediaType[], pause: boolean) => Promise<boolean>;
|
|
60
|
-
subscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<unknown>;
|
|
61
|
-
stopSubscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<boolean>;
|
|
62
|
-
setBanBehaviors: (usersBehaviors: Array<{
|
|
63
|
-
id: string;
|
|
64
|
-
banBehaviors: { [key in import('./enums').K_mediaType]?: boolean; };
|
|
65
|
-
}>) => Promise<unknown>;
|
|
66
|
-
toggleRoomSpeechLang: (data: {
|
|
67
|
-
input: string;
|
|
68
|
-
output: string;
|
|
69
|
-
translateEnable?: boolean;
|
|
70
|
-
}) => void;
|
|
71
|
-
updateToken: (sdkToken: string) => void;
|
|
72
|
-
quitRoom: () => Promise<boolean>;
|
|
73
|
-
quitRoomEx: () => Promise<boolean>;
|
|
74
|
-
destroy: () => void;
|
|
75
|
-
addRequestAnimationFrame: (key: string, func: FrameRequestCallback, options?: {
|
|
76
|
-
fps?: number;
|
|
77
|
-
}) => void;
|
|
78
|
-
clearRequestAnimationFrame: (keys?: string[]) => void;
|
|
79
|
-
getLocalUserTrackReports: (mediaType: import('./enums').K_mediaType) => import('./types').TrackReport;
|
|
80
|
-
getRemoteUserTrackReports: (userId: string, origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: import('./enums').K_mediaType) => import('./types').TrackReport | undefined;
|
|
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
|
-
_testQuitRoom: () => void;
|
|
86
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { K_mediaType } from '../enums/mediaType';
|
|
2
|
-
import { Base } from '../base/Base';
|
|
3
|
-
export declare class ActionP2P {
|
|
4
|
-
base: Base;
|
|
5
|
-
private _p2pCheckTimeoutMap;
|
|
6
|
-
constructor({ base }: {
|
|
7
|
-
base: Base;
|
|
8
|
-
});
|
|
9
|
-
_openP2P: (remoteUserId: string, mediaTypes: K_mediaType[], isRemotePush: boolean) => Promise<void>;
|
|
10
|
-
private _onOffer;
|
|
11
|
-
private _onCandidate;
|
|
12
|
-
private _getRemoteUserP2PContent;
|
|
13
|
-
destroy: () => void;
|
|
14
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { K_mediaType } from '../enums/mediaType';
|
|
2
|
-
import { RoomOptions, UserMediaTypes } from '../types';
|
|
3
|
-
import { Base } from '../base/Base';
|
|
4
|
-
export declare class ActionSFU {
|
|
5
|
-
base: Base;
|
|
6
|
-
private _onOnline?;
|
|
7
|
-
private _reconnectTimerId?;
|
|
8
|
-
/** 网络计算是否进行中,用于避免与 interval 重叠执行 */
|
|
9
|
-
private _networkCalculating;
|
|
10
|
-
/** 上次打印 generateTrackAnalysis 超时告警的时间,用于限流(每 30 秒最多一次) */
|
|
11
|
-
private _lastTrackAnalysisWarnTime;
|
|
12
|
-
constructor({ base }: {
|
|
13
|
-
base: Base;
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* setLocalStream
|
|
17
|
-
* @param mediaTypes K_mediaType[]
|
|
18
|
-
* @param active boolean
|
|
19
|
-
*/
|
|
20
|
-
setLocalStream: (mediaTypes: K_mediaType[], active: boolean) => Promise<unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* setMediaDeviceKind
|
|
23
|
-
* @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
|
|
24
|
-
* @param deviceId string | undefined
|
|
25
|
-
*/
|
|
26
|
-
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<unknown>;
|
|
27
|
-
/**
|
|
28
|
-
* setMediaTrackConstraints
|
|
29
|
-
* @param mediaType K_mediaType
|
|
30
|
-
* @param constraints MediaTrackConstraints
|
|
31
|
-
*/
|
|
32
|
-
setMediaTrackConstraints: (mediaType: K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* earlyConnect
|
|
35
|
-
* @param mediaTypes ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[]
|
|
36
|
-
*/
|
|
37
|
-
earlyConnect: (mediaTypes?: K_mediaType[]) => Promise<unknown>;
|
|
38
|
-
/**
|
|
39
|
-
* joinRoom
|
|
40
|
-
* @param roomOptions RoomOptions
|
|
41
|
-
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
|
|
42
|
-
* @returns Promise<boolean>
|
|
43
|
-
*/
|
|
44
|
-
joinRoom: (roomOptions: RoomOptions) => Promise<unknown>;
|
|
45
|
-
/**
|
|
46
|
-
* publish
|
|
47
|
-
* @param mediaTypes MediaType[]
|
|
48
|
-
* @example quickvo.publish(['mc_audio', 'mc_video'])
|
|
49
|
-
*/
|
|
50
|
-
publish: (mediaTypes: K_mediaType[]) => Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* stopPublish
|
|
53
|
-
* @param trackNames string[] = []
|
|
54
|
-
* @example quickvo.stopPublish(['mc_audio'])
|
|
55
|
-
*/
|
|
56
|
-
stopPublish: (mediaTypes: K_mediaType[]) => Promise<boolean>;
|
|
57
|
-
/**
|
|
58
|
-
* pauseTracks
|
|
59
|
-
* @param mediaTypes MediaType[]
|
|
60
|
-
* @param pause boolean
|
|
61
|
-
* @example quickvo.pauseTracks(['mc_audio'], true)
|
|
62
|
-
*/
|
|
63
|
-
pauseTracks: (mediaTypes: K_mediaType[], pause: boolean) => Promise<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* subscribe
|
|
66
|
-
* @param usersMediaTypes: UserMediaTypes[] = [] 不传入订阅所有
|
|
67
|
-
* @example quickvo.subscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
|
|
68
|
-
*/
|
|
69
|
-
subscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<unknown>;
|
|
70
|
-
/**
|
|
71
|
-
* stopSubscribe
|
|
72
|
-
* @param usersMediaTypes: UserMediaTypes[] = [] 不传入取消订阅所有
|
|
73
|
-
* @example quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
|
|
74
|
-
* @returns Promise<boolean>
|
|
75
|
-
*/
|
|
76
|
-
stopSubscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<boolean>;
|
|
77
|
-
/**
|
|
78
|
-
* quitRoom
|
|
79
|
-
* @example quickvo.quitRoom()
|
|
80
|
-
* @returns Promise<boolean>
|
|
81
|
-
*/
|
|
82
|
-
quitRoom: () => Promise<boolean>;
|
|
83
|
-
/**
|
|
84
|
-
* quitRoom and continuously open the connection
|
|
85
|
-
* @example quickvo.quitRoomEx()
|
|
86
|
-
* @returns Promise<boolean>
|
|
87
|
-
*/
|
|
88
|
-
quitRoomEx: () => Promise<boolean>;
|
|
89
|
-
/**
|
|
90
|
-
* setBanBehaviors
|
|
91
|
-
* @param usersBehaviors Array<{ id: string; banBehaviors: { [key in K_mediaType]?: boolean } }>
|
|
92
|
-
*/
|
|
93
|
-
setBanBehaviors: (usersBehaviors: Array<{
|
|
94
|
-
id: string;
|
|
95
|
-
banBehaviors: { [key in K_mediaType]?: boolean; };
|
|
96
|
-
}>) => Promise<unknown>;
|
|
97
|
-
/**
|
|
98
|
-
* toggleRoomSpeechLang
|
|
99
|
-
* @param data { input: string; output: string; translateEnable?: boolean }
|
|
100
|
-
*/
|
|
101
|
-
toggleRoomSpeechLang: (data: {
|
|
102
|
-
input: string;
|
|
103
|
-
output: string;
|
|
104
|
-
translateEnable?: boolean;
|
|
105
|
-
}) => void;
|
|
106
|
-
/**
|
|
107
|
-
* updateToken
|
|
108
|
-
* @param sdkToken string
|
|
109
|
-
*/
|
|
110
|
-
updateToken: (sdkToken: string) => void;
|
|
111
|
-
/**
|
|
112
|
-
* destroy
|
|
113
|
-
*/
|
|
114
|
-
destroy: () => void;
|
|
115
|
-
private _clear;
|
|
116
|
-
private _connectCws;
|
|
117
|
-
private _reconnectCws;
|
|
118
|
-
private _initHeartbeat;
|
|
119
|
-
private _connectCF;
|
|
120
|
-
private _createTrack;
|
|
121
|
-
private _closeTrack;
|
|
122
|
-
private _pubNotify;
|
|
123
|
-
private _renegotiate;
|
|
124
|
-
private _ackMsg;
|
|
125
|
-
private _notifySelfCallAction;
|
|
126
|
-
private _calculateNetwork;
|
|
127
|
-
private _checkAndSelectUserStreamOrigin;
|
|
128
|
-
private _reportNetwork;
|
|
129
|
-
private _hasAsyncTask;
|
|
130
|
-
private _syncRoomInfo;
|
|
131
|
-
private _restorePeer;
|
|
132
|
-
_restoreRoom: () => Promise<void>;
|
|
133
|
-
}
|
package/dist/src/base/Base.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Config } from './modules/Config';
|
|
2
|
-
import { Traffic } from './modules/Traffic';
|
|
3
|
-
import { Notifys } from './modules/Notifys';
|
|
4
|
-
import { Users } from './modules/users/Users';
|
|
5
|
-
import { PrIntervalQueue } from 'pr-interval-queue';
|
|
6
|
-
import { LocalMedias } from './modules/LocalMedias';
|
|
7
|
-
import { Peer } from './modules/Peer';
|
|
8
|
-
import { CallsWebSocket } from './modules/cws/CallsWebSocket';
|
|
9
|
-
import { StreamRecorder } from './modules/StreamRecorder';
|
|
10
|
-
import { PrAsyncQueue } from 'pr-async-queue';
|
|
11
|
-
import { K_roomState } from '../enums/roomState';
|
|
12
|
-
import { K_mediaType } from '../enums/mediaType';
|
|
13
|
-
import { K_callStrategy } from '../enums';
|
|
14
|
-
import { AnimationFrame } from './modules/AnimationFrame';
|
|
15
|
-
type Report_Log_Type = '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';
|
|
16
|
-
interface RnnoiseWorkletInstance {
|
|
17
|
-
createRnnoiseWorkletNode: (audioContext: AudioContext) => Promise<AudioWorkletNode>;
|
|
18
|
-
destroy: () => void;
|
|
19
|
-
}
|
|
20
|
-
export interface PrRnnoise {
|
|
21
|
-
RnnoiseWorklet: new () => RnnoiseWorkletInstance;
|
|
22
|
-
}
|
|
23
|
-
export declare class Base {
|
|
24
|
-
config: Config;
|
|
25
|
-
notifys: Notifys;
|
|
26
|
-
localMedias: LocalMedias;
|
|
27
|
-
intervalQueue: PrIntervalQueue;
|
|
28
|
-
asyncQueue: PrAsyncQueue;
|
|
29
|
-
traffic: Traffic;
|
|
30
|
-
recorder: StreamRecorder;
|
|
31
|
-
animationFrame: AnimationFrame;
|
|
32
|
-
users: Users;
|
|
33
|
-
cws: CallsWebSocket;
|
|
34
|
-
peer: Peer;
|
|
35
|
-
constructor();
|
|
36
|
-
/**
|
|
37
|
-
* 使用插件
|
|
38
|
-
*/
|
|
39
|
-
use: ({ rnnoise }: {
|
|
40
|
-
rnnoise?: PrRnnoise;
|
|
41
|
-
}) => void;
|
|
42
|
-
setRoomState: (state: K_roomState) => void;
|
|
43
|
-
setPeerState: (state: RTCPeerConnectionState) => void;
|
|
44
|
-
setCallStrategy: (callStrategy: K_callStrategy, mediaTypes?: K_mediaType[]) => Promise<void>;
|
|
45
|
-
_checkUserStreamOrigin: ({ p2pAverageQuality, sfuAverageQuality }: {
|
|
46
|
-
p2pAverageQuality: number;
|
|
47
|
-
sfuAverageQuality: number;
|
|
48
|
-
}) => "sfu" | "p2p";
|
|
49
|
-
_reportP2PConnect: (state: "success" | "fail" | "ignore" | "disconnect" | "poor_network", data: {
|
|
50
|
-
action?: 0 | 1 | 2 | 3;
|
|
51
|
-
pullId: string;
|
|
52
|
-
pushId: string;
|
|
53
|
-
mediaTypes: K_mediaType[];
|
|
54
|
-
desc?: string;
|
|
55
|
-
connectedTime?: string;
|
|
56
|
-
}) => Promise<Pick<import('../protos/protoEvent').MessageRsp<"reportP2PConnectEx">, "sn" | "event" | "data" | "code" | "desc">> | undefined;
|
|
57
|
-
_reportLog: (_type: Report_Log_Type, describe?: string) => void;
|
|
58
|
-
}
|
|
59
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare class AnimationFrame {
|
|
2
|
-
private _requestAnimationFrameId?;
|
|
3
|
-
private _requestAnimationFrameItems;
|
|
4
|
-
/** 每个 key 对应的上次调用时间(ms),用于按 fps 节流 */
|
|
5
|
-
private _lastInvokeTime;
|
|
6
|
-
/**
|
|
7
|
-
* add FrameRequestCallback
|
|
8
|
-
* @param key string
|
|
9
|
-
* @param func FrameRequestCallback
|
|
10
|
-
* @param options.fps 目标帧率(每秒调用次数),默认 20
|
|
11
|
-
*/
|
|
12
|
-
addRequestAnimationFrame: (key: string, func: FrameRequestCallback, options?: {
|
|
13
|
-
fps?: number;
|
|
14
|
-
}) => void;
|
|
15
|
-
/**
|
|
16
|
-
* clear FrameRequestCallback
|
|
17
|
-
* @param keys string[] = []
|
|
18
|
-
*/
|
|
19
|
-
clearRequestAnimationFrame: (keys?: string[]) => void;
|
|
20
|
-
init: () => void;
|
|
21
|
-
stop: () => void;
|
|
22
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { QuickOptions, RoomOptions } from '../../types';
|
|
2
|
-
import { K_roomState } from '../../enums/roomState';
|
|
3
|
-
export declare class Config {
|
|
4
|
-
/**
|
|
5
|
-
* 信令服务地址
|
|
6
|
-
*/
|
|
7
|
-
url: string;
|
|
8
|
-
/**
|
|
9
|
-
* 应用ID
|
|
10
|
-
*/
|
|
11
|
-
appid: string;
|
|
12
|
-
/**
|
|
13
|
-
* 是否开启调试模式
|
|
14
|
-
*/
|
|
15
|
-
debug: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* 是否上报错误信息
|
|
18
|
-
*/
|
|
19
|
-
reportErr: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* 日志上报地址
|
|
22
|
-
*/
|
|
23
|
-
logUrl: string;
|
|
24
|
-
/**
|
|
25
|
-
* SDK凭证
|
|
26
|
-
*/
|
|
27
|
-
sdkToken: string;
|
|
28
|
-
/**
|
|
29
|
-
* 房间ID
|
|
30
|
-
*/
|
|
31
|
-
roomId: string;
|
|
32
|
-
/**
|
|
33
|
-
* 用户ID
|
|
34
|
-
*/
|
|
35
|
-
userId: string;
|
|
36
|
-
/**
|
|
37
|
-
* 通讯类型
|
|
38
|
-
*/
|
|
39
|
-
callType: number;
|
|
40
|
-
/**
|
|
41
|
-
* 是否开启语音翻译
|
|
42
|
-
*/
|
|
43
|
-
stt: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* 语音翻译 语言选择
|
|
46
|
-
*/
|
|
47
|
-
lang: {
|
|
48
|
-
input: string;
|
|
49
|
-
output: string;
|
|
50
|
-
translateEnable: boolean;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* 是否开启P2P
|
|
54
|
-
*/
|
|
55
|
-
useP2P: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* 新媒体流是否自动订阅
|
|
58
|
-
*/
|
|
59
|
-
newPublishAutoSubscribe: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* 房间状态
|
|
62
|
-
*/
|
|
63
|
-
roomState: K_roomState;
|
|
64
|
-
/**
|
|
65
|
-
* 会话状态
|
|
66
|
-
*/
|
|
67
|
-
peerState: RTCPeerConnectionState;
|
|
68
|
-
version: string;
|
|
69
|
-
/**
|
|
70
|
-
* sdk服务版本
|
|
71
|
-
*/
|
|
72
|
-
serviceVersion: string;
|
|
73
|
-
/**
|
|
74
|
-
* call 凭证
|
|
75
|
-
*/
|
|
76
|
-
callSession: string;
|
|
77
|
-
/**
|
|
78
|
-
* 是否开启预连接
|
|
79
|
-
*/
|
|
80
|
-
isEarly: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* 预连接ID
|
|
83
|
-
*/
|
|
84
|
-
earlyId: string;
|
|
85
|
-
/**
|
|
86
|
-
* 是否在房间内
|
|
87
|
-
*/
|
|
88
|
-
isInRoom: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* sfu 优先级 p2p的网络质量 >= sfu网络质量 + sfuPriority 才切换至p2p 否则切换至sfu
|
|
91
|
-
*/
|
|
92
|
-
sfuPriority: number;
|
|
93
|
-
/**
|
|
94
|
-
* 总网络质量
|
|
95
|
-
*/
|
|
96
|
-
network: {
|
|
97
|
-
sfu: {
|
|
98
|
-
inboundBytes: number;
|
|
99
|
-
outboundBytes: number;
|
|
100
|
-
lostRate: number;
|
|
101
|
-
roundTripTime: number;
|
|
102
|
-
jitter: number;
|
|
103
|
-
quality: number;
|
|
104
|
-
averageQuality: number;
|
|
105
|
-
velocityPush: number;
|
|
106
|
-
velocityPull: number;
|
|
107
|
-
};
|
|
108
|
-
p2p: {
|
|
109
|
-
inboundBytes: number;
|
|
110
|
-
outboundBytes: number;
|
|
111
|
-
lostRate: number;
|
|
112
|
-
roundTripTime: number;
|
|
113
|
-
jitter: number;
|
|
114
|
-
quality: number;
|
|
115
|
-
averageQuality: number;
|
|
116
|
-
velocityPush: number;
|
|
117
|
-
velocityPull: number;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
codecPreferences: {
|
|
121
|
-
audio: RTCRtpCodec[];
|
|
122
|
-
video: RTCRtpCodec[];
|
|
123
|
-
};
|
|
124
|
-
constructor();
|
|
125
|
-
/**
|
|
126
|
-
* setOptions
|
|
127
|
-
*/
|
|
128
|
-
setOptions: (options: Partial<QuickOptions & RoomOptions>) => void;
|
|
129
|
-
createWsUrl: () => string;
|
|
130
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { K_mediaType } from '../../enums/mediaType';
|
|
2
|
-
import { DeviceInfo } from '../../types';
|
|
3
|
-
interface On {
|
|
4
|
-
devicechange?: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare class LocalMedias {
|
|
7
|
-
audioContext: AudioContext;
|
|
8
|
-
private _onDocumentClick?;
|
|
9
|
-
private _onDeviceChange?;
|
|
10
|
-
private _destroyed;
|
|
11
|
-
private phoneyStreamTracks;
|
|
12
|
-
private enumerateDevices;
|
|
13
|
-
private useMediaDevices;
|
|
14
|
-
/**
|
|
15
|
-
* 媒体轨道参数管理
|
|
16
|
-
*/
|
|
17
|
-
private mediaTrackConstraints;
|
|
18
|
-
private localStreamTracks;
|
|
19
|
-
on: On;
|
|
20
|
-
constructor();
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param kind 'audio' | 'video
|
|
24
|
-
* @returns MediaStreamTrack
|
|
25
|
-
*/
|
|
26
|
-
getPhoneyStreamTrack: (mediaType: K_mediaType) => MediaStreamTrack;
|
|
27
|
-
/**
|
|
28
|
-
* initLocalStreamTrack
|
|
29
|
-
*/
|
|
30
|
-
initLocalStreamTrack: (mediaType: K_mediaType | "mc" | "ss") => Promise<void>;
|
|
31
|
-
getLocalStreamTrack: (mediaType: K_mediaType) => MediaStreamTrack | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* checkLocalStreamTracks
|
|
34
|
-
*/
|
|
35
|
-
checkLocalStreamTracks: (mediaTypes: K_mediaType[]) => {
|
|
36
|
-
valid_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
37
|
-
invalid_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* 停止本地流轨道
|
|
41
|
-
* @param mediaType
|
|
42
|
-
*/
|
|
43
|
-
stopLocalStreamTrack: (mediaType: K_mediaType) => void;
|
|
44
|
-
/**
|
|
45
|
-
* 是否已开启媒体设备
|
|
46
|
-
* @param mediaType
|
|
47
|
-
* @returns boolean
|
|
48
|
-
*/
|
|
49
|
-
isOpenMediaDevice: (mediaType: K_mediaType) => boolean;
|
|
50
|
-
/**
|
|
51
|
-
* setMediaTrackConstraints
|
|
52
|
-
* @param mediaType K_mediaType
|
|
53
|
-
* @param constraints MediaTrackConstraints
|
|
54
|
-
*/
|
|
55
|
-
setMediaTrackConstraints: (mediaType: K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* getMediaDeviceKind
|
|
58
|
-
* @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
|
|
59
|
-
* @returns deviceId string
|
|
60
|
-
*/
|
|
61
|
-
getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
|
|
62
|
-
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* changeAudiooutput
|
|
65
|
-
*/
|
|
66
|
-
changeAudiooutput: () => Promise<void>;
|
|
67
|
-
getMediaDevicesErrInfo: () => Promise<{
|
|
68
|
-
mc_audio: string;
|
|
69
|
-
mc_video: string;
|
|
70
|
-
}>;
|
|
71
|
-
/**
|
|
72
|
-
* getEnumerateDevices
|
|
73
|
-
* @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
|
|
74
|
-
* @returns MediaDeviceInfo[]
|
|
75
|
-
*/
|
|
76
|
-
getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<DeviceInfo[]>;
|
|
77
|
-
/**
|
|
78
|
-
* getEnumerateAudioinputDevices
|
|
79
|
-
* @returns MediaDeviceInfo[]
|
|
80
|
-
*/
|
|
81
|
-
getEnumerateAudioinputDevices: () => Promise<DeviceInfo[]>;
|
|
82
|
-
/**
|
|
83
|
-
* getEnumerateAudioOutputDevices
|
|
84
|
-
* @returns MediaDeviceInfo[]
|
|
85
|
-
*/
|
|
86
|
-
getEnumerateAudioOutputDevices: () => Promise<DeviceInfo[]>;
|
|
87
|
-
/**
|
|
88
|
-
* getEnumerateVideoinputDevices
|
|
89
|
-
* @returns MediaDeviceInfo[]
|
|
90
|
-
*/
|
|
91
|
-
getEnumerateVideoinputDevices: () => Promise<DeviceInfo[]>;
|
|
92
|
-
private _getAllEnumerateDevices;
|
|
93
|
-
private _getSafetyMediaDeviceKind;
|
|
94
|
-
destroy: () => Promise<void>;
|
|
95
|
-
}
|
|
96
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
type NotifyName = 'onLog' | 'onRoomUsers' | 'onJoinRoom' | 'onPublish' | 'onQuitRoom' | 'onRoomNetwork' | 'onDevicechange' | 'onCDNPlayUrlAdd' | 'onRoomUserSpeech' | 'onBeforeTokenExpire' | 'onTokenExpired' | 'onPeerState' | 'onRoomState' | 'onDestroyRoom';
|
|
2
|
-
/**
|
|
3
|
-
* 广播
|
|
4
|
-
*/
|
|
5
|
-
type Notify = {
|
|
6
|
-
/**
|
|
7
|
-
* 事件随机码
|
|
8
|
-
*/
|
|
9
|
-
sn?: string;
|
|
10
|
-
/**
|
|
11
|
-
* 事件名称 支持同一事件名称在多个地方注册
|
|
12
|
-
*/
|
|
13
|
-
event: NotifyName;
|
|
14
|
-
/**
|
|
15
|
-
* 自定义回调函数
|
|
16
|
-
*/
|
|
17
|
-
callback?: (e: any) => void;
|
|
18
|
-
};
|
|
19
|
-
interface Result {
|
|
20
|
-
code: number;
|
|
21
|
-
data: any;
|
|
22
|
-
desc: string;
|
|
23
|
-
sn?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class Notifys {
|
|
26
|
-
queue: Map<NotifyName, Notify[]>;
|
|
27
|
-
/**
|
|
28
|
-
* 派发广播事件
|
|
29
|
-
* @param event 事件名称
|
|
30
|
-
* @param result 事件响应值
|
|
31
|
-
*/
|
|
32
|
-
emit: (event: NotifyName, result: Result) => void;
|
|
33
|
-
/**
|
|
34
|
-
* 添加广播
|
|
35
|
-
* @param notify
|
|
36
|
-
* @param _private
|
|
37
|
-
* @returns sn
|
|
38
|
-
*/
|
|
39
|
-
add: (notify: Notify) => string;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { K_mediaType } from '../../enums/mediaType';
|
|
2
|
-
import { UserTrack } from '../../types';
|
|
3
|
-
import { Config } from './Config';
|
|
4
|
-
import { Users } from './users/Users';
|
|
5
|
-
import { PrResolves } from './PrResolves';
|
|
6
|
-
interface On {
|
|
7
|
-
state?: (_state: 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed') => void;
|
|
8
|
-
}
|
|
9
|
-
export declare class Peer {
|
|
10
|
-
config: Config;
|
|
11
|
-
users: Users;
|
|
12
|
-
prResolves: PrResolves<"peerConnected">;
|
|
13
|
-
pc: RTCPeerConnection;
|
|
14
|
-
transceiverMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", RTCRtpTransceiver>;
|
|
15
|
-
transceiverTrackMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", UserTrack>;
|
|
16
|
-
private iceConnectionTimer;
|
|
17
|
-
simulcast: 'f' | 'h' | 'q';
|
|
18
|
-
on: On;
|
|
19
|
-
waitings: {
|
|
20
|
-
peerConnected: () => Promise<unknown>;
|
|
21
|
-
};
|
|
22
|
-
constructor({ config, users }: {
|
|
23
|
-
config: Config;
|
|
24
|
-
users: Users;
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* setRTCRtpSenderParameters
|
|
28
|
-
* @param parameters RTCRtpSendParameters
|
|
29
|
-
*/
|
|
30
|
-
setRTCRtpSenderParameters: (parameters: Partial<RTCRtpSendParameters>, mediaTypes?: K_mediaType[]) => Promise<void>;
|
|
31
|
-
init: () => Promise<void>;
|
|
32
|
-
close: () => void;
|
|
33
|
-
addSenders: (mediaTypes: K_mediaType[]) => Promise<("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[]>;
|
|
34
|
-
syncSenderStreamTrack: (mediaTypes: K_mediaType[]) => Promise<void>;
|
|
35
|
-
stopSenders: (mediaTypes: K_mediaType[]) => void;
|
|
36
|
-
hasSender: (mediaType: K_mediaType) => boolean;
|
|
37
|
-
replaceSenderTrack: (mediaType: K_mediaType, track: MediaStreamTrack) => Promise<void>;
|
|
38
|
-
getSenderUserTracks: (mediaTypes?: K_mediaType[]) => UserTrack[];
|
|
39
|
-
getTransceiver: (mid: string | null) => RTCRtpTransceiver | undefined;
|
|
40
|
-
getSenderTrack: (mediaType: K_mediaType) => MediaStreamTrack | null | undefined;
|
|
41
|
-
getRecvierTrack: (mid: string | null) => MediaStreamTrack | undefined;
|
|
42
|
-
stopReceivers: (mids: string[]) => void;
|
|
43
|
-
createOffer: () => Promise<void>;
|
|
44
|
-
createAnswer: () => Promise<void>;
|
|
45
|
-
getSdp: () => string;
|
|
46
|
-
setRemoteDescription: (description: RTCSessionDescriptionInit) => Promise<RTCSessionDescriptionInit>;
|
|
47
|
-
}
|
|
48
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type ResolveInfo = Map<string, {
|
|
2
|
-
resolve: (boolean: true) => void;
|
|
3
|
-
reject: (error?: string) => void;
|
|
4
|
-
timer: number;
|
|
5
|
-
}>;
|
|
6
|
-
export declare class PrResolves<T extends string> {
|
|
7
|
-
resolvesMap: Map<string, ResolveInfo>;
|
|
8
|
-
index: number;
|
|
9
|
-
constructor();
|
|
10
|
-
emit: (eventKey: T) => Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param eventKey 唯一key
|
|
14
|
-
* @param checkFun 检测函数
|
|
15
|
-
* @param timeout 超时时间(ms) 默认 1000 * 30
|
|
16
|
-
*/
|
|
17
|
-
add: (eventKey: T, checkFun?: Function, timeout?: number) => Promise<unknown>;
|
|
18
|
-
/**
|
|
19
|
-
* 清理所有约定
|
|
20
|
-
*/
|
|
21
|
-
clear: () => void;
|
|
22
|
-
}
|
|
23
|
-
export {};
|