@hysc/meeting 1.6.18 → 1.6.20
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/esm/BMChat/BMChatVM.d.ts +24 -24
- package/esm/BMChat/BMMessageInfo.d.ts +27 -27
- package/esm/BMRoom/BMLiveVM.d.ts +35 -35
- package/esm/BMRoom/BMRoom.d.ts +5 -1
- package/esm/BMStream/BMSpeaker.d.ts +44 -44
- package/esm/BMStream/getHTMLMediaStreamOptions.d.ts +35 -35
- package/esm/bjy-common/function/execute.d.ts +9 -9
- package/esm/bjy-common/function/isNative.d.ts +1 -1
- package/esm/bjy-common/function/nextTick.d.ts +2 -2
- package/esm/bjy-common/function/toString.d.ts +1 -1
- package/esm/bjy-common/util/CustomEvent.d.ts +30 -30
- package/esm/bjy-common/util/Emitter.d.ts +57 -57
- package/esm/bjy-common/util/array.d.ts +96 -96
- package/esm/bjy-common/util/constant.d.ts +50 -50
- package/esm/bjy-common/util/is.d.ts +49 -49
- package/esm/bjy-common/util/keypath.d.ts +41 -41
- package/esm/bjy-common/util/logger.d.ts +42 -42
- package/esm/bjy-common/util/object.d.ts +83 -83
- package/esm/bjy-common/util/string.d.ts +102 -102
- package/esm/constants.d.ts +83 -83
- package/esm/index.js +1 -1
- package/esm/index.js.map +2 -2
- package/esm/util/emitter.d.ts +18 -18
- package/esm/util/roomUtils.d.ts +9 -9
- package/esm/util/util.d.ts +76 -76
- package/package.json +3 -3
- package/umd/BMChat/BMChatVM.d.ts +24 -0
- package/umd/BMChat/BMMessageInfo.d.ts +27 -0
- package/umd/BMRoom/BMLiveVM.d.ts +35 -0
- package/umd/BMRoom/BMRoom.d.ts +5 -1
- package/umd/BMStream/BMSpeaker.d.ts +44 -0
- package/umd/BMStream/getHTMLMediaStreamOptions.d.ts +35 -0
- package/umd/bjy-common/function/execute.d.ts +9 -0
- package/umd/bjy-common/function/isNative.d.ts +1 -0
- package/umd/bjy-common/function/nextTick.d.ts +2 -0
- package/umd/bjy-common/function/toString.d.ts +1 -0
- package/umd/bjy-common/util/CustomEvent.d.ts +30 -0
- package/umd/bjy-common/util/Emitter.d.ts +57 -0
- package/umd/bjy-common/util/array.d.ts +96 -0
- package/umd/bjy-common/util/constant.d.ts +50 -0
- package/umd/bjy-common/util/is.d.ts +49 -0
- package/umd/bjy-common/util/keypath.d.ts +41 -0
- package/umd/bjy-common/util/logger.d.ts +42 -0
- package/umd/bjy-common/util/object.d.ts +83 -0
- package/umd/bjy-common/util/string.d.ts +102 -0
- package/umd/constants.d.ts +83 -0
- package/umd/index.js +1 -1
- package/umd/util/emitter.d.ts +18 -0
- package/umd/util/roomUtils.d.ts +9 -0
- package/umd/util/util.d.ts +76 -0
package/esm/util/emitter.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ConnectErrorMessage, SubscribeMessage } from "../BMStream/BMStreamModel";
|
|
2
|
-
import { BIND_BIG_ELEMENT, BIND_ELEMENT, CHANG_IS_GUEST, HANDLE_STREAM_CONNECT_ERROR, MANUAL_SUBSCRIPTION, RAISE_HAND, RECEIVE_SUBSCRIBE_MESSAGE, UNSUBSCRIBE_STREAM, USER_SORT_NUM_CHANGE } from "../constants";
|
|
3
|
-
import { RaiseHandInfo } from "../BMUser/BMUser";
|
|
4
|
-
import { ChangeIsGuest } from "../BMUser/BMUserVM";
|
|
5
|
-
declare type Events = {
|
|
6
|
-
[RECEIVE_SUBSCRIBE_MESSAGE]: SubscribeMessage;
|
|
7
|
-
[USER_SORT_NUM_CHANGE]: null;
|
|
8
|
-
[HANDLE_STREAM_CONNECT_ERROR]: ConnectErrorMessage;
|
|
9
|
-
[RAISE_HAND]: RaiseHandInfo;
|
|
10
|
-
[UNSUBSCRIBE_STREAM]: SubscribeMessage;
|
|
11
|
-
[MANUAL_SUBSCRIPTION]: SubscribeMessage;
|
|
12
|
-
[CHANG_IS_GUEST]: ChangeIsGuest;
|
|
13
|
-
[BIND_ELEMENT]: SubscribeMessage;
|
|
14
|
-
[BIND_BIG_ELEMENT]: SubscribeMessage;
|
|
15
|
-
};
|
|
16
|
-
export declare const emitter: import("mitt").Emitter<Events>;
|
|
17
|
-
export declare const removeEmitter: () => void;
|
|
18
|
-
export {};
|
|
1
|
+
import { ConnectErrorMessage, SubscribeMessage } from "../BMStream/BMStreamModel";
|
|
2
|
+
import { BIND_BIG_ELEMENT, BIND_ELEMENT, CHANG_IS_GUEST, HANDLE_STREAM_CONNECT_ERROR, MANUAL_SUBSCRIPTION, RAISE_HAND, RECEIVE_SUBSCRIBE_MESSAGE, UNSUBSCRIBE_STREAM, USER_SORT_NUM_CHANGE } from "../constants";
|
|
3
|
+
import { RaiseHandInfo } from "../BMUser/BMUser";
|
|
4
|
+
import { ChangeIsGuest } from "../BMUser/BMUserVM";
|
|
5
|
+
declare type Events = {
|
|
6
|
+
[RECEIVE_SUBSCRIBE_MESSAGE]: SubscribeMessage;
|
|
7
|
+
[USER_SORT_NUM_CHANGE]: null;
|
|
8
|
+
[HANDLE_STREAM_CONNECT_ERROR]: ConnectErrorMessage;
|
|
9
|
+
[RAISE_HAND]: RaiseHandInfo;
|
|
10
|
+
[UNSUBSCRIBE_STREAM]: SubscribeMessage;
|
|
11
|
+
[MANUAL_SUBSCRIPTION]: SubscribeMessage;
|
|
12
|
+
[CHANG_IS_GUEST]: ChangeIsGuest;
|
|
13
|
+
[BIND_ELEMENT]: SubscribeMessage;
|
|
14
|
+
[BIND_BIG_ELEMENT]: SubscribeMessage;
|
|
15
|
+
};
|
|
16
|
+
export declare const emitter: import("mitt").Emitter<Events>;
|
|
17
|
+
export declare const removeEmitter: () => void;
|
|
18
|
+
export {};
|
package/esm/util/roomUtils.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SingleRemoteStream } from "../type";
|
|
2
|
-
/**
|
|
3
|
-
* @name: roomUtils
|
|
4
|
-
* @author: yangliye
|
|
5
|
-
* @date: 2022-12-06 09:31
|
|
6
|
-
* @description:roomUtils
|
|
7
|
-
* @update: 2022-12-06 09:31
|
|
8
|
-
*/
|
|
9
|
-
export declare function isShareStream(remoteStream: SingleRemoteStream): boolean;
|
|
1
|
+
import { SingleRemoteStream } from "../type";
|
|
2
|
+
/**
|
|
3
|
+
* @name: roomUtils
|
|
4
|
+
* @author: yangliye
|
|
5
|
+
* @date: 2022-12-06 09:31
|
|
6
|
+
* @description:roomUtils
|
|
7
|
+
* @update: 2022-12-06 09:31
|
|
8
|
+
*/
|
|
9
|
+
export declare function isShareStream(remoteStream: SingleRemoteStream): boolean;
|
package/esm/util/util.d.ts
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import BMUser from '../BMUser/BMUser';
|
|
2
|
-
import BMStreamModel from '../BMStream/BMStreamModel';
|
|
3
|
-
export declare const notGetTalkInterval: number;
|
|
4
|
-
/**
|
|
5
|
-
* 生成唯一 id
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
* @returns id
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateUUID(): string;
|
|
11
|
-
/**
|
|
12
|
-
* 将函数回调转换为 Promise
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
* @typeParam T 回调结果类型
|
|
16
|
-
* @typeParam This 函数执行上下文
|
|
17
|
-
* @param fn 回调函数
|
|
18
|
-
* @param args 函数执行参数
|
|
19
|
-
* @param ctx 函数执行上下文
|
|
20
|
-
* @param hasResolve 是否有成功回调
|
|
21
|
-
* @returns 回调结果
|
|
22
|
-
*/
|
|
23
|
-
export declare function callbackToPromise<T, This>(fn: any, args: any[], ctx: any, hasResolve?: boolean): Promise<T | void>;
|
|
24
|
-
/**
|
|
25
|
-
* 创建 AudioContext
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
|
-
* @returns AudioContext
|
|
29
|
-
*/
|
|
30
|
-
export declare function getAudioContext(): AudioContext;
|
|
31
|
-
/**
|
|
32
|
-
* 创建 AudioMeter
|
|
33
|
-
*
|
|
34
|
-
* @internal
|
|
35
|
-
* @param audioContext
|
|
36
|
-
* @param clipLevel
|
|
37
|
-
* @param averaging
|
|
38
|
-
* @param clipLag
|
|
39
|
-
* @returns ScriptProcessorNode
|
|
40
|
-
*/
|
|
41
|
-
export declare function createAudioMeter(audioContext: AudioContext, clipLevel?: number, averaging?: number, clipLag?: number): ScriptProcessorNode;
|
|
42
|
-
/**
|
|
43
|
-
* 放置 AudioMeter
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
|
-
* @param stream
|
|
47
|
-
* @param mediaStream
|
|
48
|
-
*/
|
|
49
|
-
export declare function createVolumeMeter(stream: any, audioTrack: MediaStreamTrack): void;
|
|
50
|
-
/**
|
|
51
|
-
* 解析 vloud 流数据
|
|
52
|
-
*
|
|
53
|
-
* @internal
|
|
54
|
-
* @param streamDeviceOption
|
|
55
|
-
* @param streamCodecOption
|
|
56
|
-
* @returns 解析结果
|
|
57
|
-
*/
|
|
58
|
-
export declare function parseVloudStreamOptions(streamDeviceOption: any, streamCodecOption: any): Object;
|
|
59
|
-
export declare function timestamp(): number;
|
|
60
|
-
export declare function resumeContext(): Promise<void>;
|
|
61
|
-
export declare function getEmptyVloudStats(): any;
|
|
62
|
-
export declare function timestampMillisecond(diffNTP?: number): number;
|
|
63
|
-
/**
|
|
64
|
-
* 处理时间戳
|
|
65
|
-
* @param {number} timeStamp
|
|
66
|
-
* @returns {string} 12:09
|
|
67
|
-
*/
|
|
68
|
-
export declare function handleTime(timeStamp: number): string;
|
|
69
|
-
export declare function sortStreamModelsOrUser<T extends BMUser | BMStreamModel>(list: T[]): T[];
|
|
70
|
-
/**
|
|
71
|
-
* 根据权限判断是不是普通参会者
|
|
72
|
-
* @param permission
|
|
73
|
-
*/
|
|
74
|
-
export declare function getIsCommonUser(permission: string): boolean;
|
|
75
|
-
export declare function getIsManager(permission: string): boolean;
|
|
76
|
-
export declare function getPermission(permission: string, p: string): boolean;
|
|
1
|
+
import BMUser from '../BMUser/BMUser';
|
|
2
|
+
import BMStreamModel from '../BMStream/BMStreamModel';
|
|
3
|
+
export declare const notGetTalkInterval: number;
|
|
4
|
+
/**
|
|
5
|
+
* 生成唯一 id
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
* @returns id
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateUUID(): string;
|
|
11
|
+
/**
|
|
12
|
+
* 将函数回调转换为 Promise
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
* @typeParam T 回调结果类型
|
|
16
|
+
* @typeParam This 函数执行上下文
|
|
17
|
+
* @param fn 回调函数
|
|
18
|
+
* @param args 函数执行参数
|
|
19
|
+
* @param ctx 函数执行上下文
|
|
20
|
+
* @param hasResolve 是否有成功回调
|
|
21
|
+
* @returns 回调结果
|
|
22
|
+
*/
|
|
23
|
+
export declare function callbackToPromise<T, This>(fn: any, args: any[], ctx: any, hasResolve?: boolean): Promise<T | void>;
|
|
24
|
+
/**
|
|
25
|
+
* 创建 AudioContext
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
* @returns AudioContext
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAudioContext(): AudioContext;
|
|
31
|
+
/**
|
|
32
|
+
* 创建 AudioMeter
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
* @param audioContext
|
|
36
|
+
* @param clipLevel
|
|
37
|
+
* @param averaging
|
|
38
|
+
* @param clipLag
|
|
39
|
+
* @returns ScriptProcessorNode
|
|
40
|
+
*/
|
|
41
|
+
export declare function createAudioMeter(audioContext: AudioContext, clipLevel?: number, averaging?: number, clipLag?: number): ScriptProcessorNode;
|
|
42
|
+
/**
|
|
43
|
+
* 放置 AudioMeter
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
* @param stream
|
|
47
|
+
* @param mediaStream
|
|
48
|
+
*/
|
|
49
|
+
export declare function createVolumeMeter(stream: any, audioTrack: MediaStreamTrack): void;
|
|
50
|
+
/**
|
|
51
|
+
* 解析 vloud 流数据
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
* @param streamDeviceOption
|
|
55
|
+
* @param streamCodecOption
|
|
56
|
+
* @returns 解析结果
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseVloudStreamOptions(streamDeviceOption: any, streamCodecOption: any): Object;
|
|
59
|
+
export declare function timestamp(): number;
|
|
60
|
+
export declare function resumeContext(): Promise<void>;
|
|
61
|
+
export declare function getEmptyVloudStats(): any;
|
|
62
|
+
export declare function timestampMillisecond(diffNTP?: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* 处理时间戳
|
|
65
|
+
* @param {number} timeStamp
|
|
66
|
+
* @returns {string} 12:09
|
|
67
|
+
*/
|
|
68
|
+
export declare function handleTime(timeStamp: number): string;
|
|
69
|
+
export declare function sortStreamModelsOrUser<T extends BMUser | BMStreamModel>(list: T[]): T[];
|
|
70
|
+
/**
|
|
71
|
+
* 根据权限判断是不是普通参会者
|
|
72
|
+
* @param permission
|
|
73
|
+
*/
|
|
74
|
+
export declare function getIsCommonUser(permission: string): boolean;
|
|
75
|
+
export declare function getIsManager(permission: string): boolean;
|
|
76
|
+
export declare function getPermission(permission: string, p: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hysc/meeting",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.20",
|
|
4
4
|
"description": "boom meeting",
|
|
5
5
|
"main": "umd/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"author": "yangliye",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@hysc/core": "1.6.
|
|
17
|
+
"@hysc/core": "1.6.12",
|
|
18
18
|
"lodash-es": "^4.17.21",
|
|
19
19
|
"mitt": "^3.0.0",
|
|
20
20
|
"@hysc/p-queue": "6.3.0",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@hysc/utils": "1.2.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@hysc/core": "1.6.
|
|
26
|
+
"@hysc/core": "1.6.12"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/lodash-es": "^4.17.6"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BoomCore from '@hysc/core/esm';
|
|
2
|
+
import BMMessageInfo from './BMMessageInfo';
|
|
3
|
+
import { BehaviorSubject, Subject } from "rxjs";
|
|
4
|
+
import BMUserVM from '../BMUser/BMUserVM';
|
|
5
|
+
import BMRoom from '../BMRoom/BMRoom';
|
|
6
|
+
export default class BMChatVM {
|
|
7
|
+
messageList: Array<BMMessageInfo>;
|
|
8
|
+
boomCore: BoomCore;
|
|
9
|
+
userVM: BMUserVM;
|
|
10
|
+
bmRoom: BMRoom;
|
|
11
|
+
messageListWatcher: BehaviorSubject<Array<BMMessageInfo>>;
|
|
12
|
+
hasDangerMessageWatcher: Subject<boolean>;
|
|
13
|
+
constructor(boomCore: BoomCore, userVM: BMUserVM, bmRoom: BMRoom);
|
|
14
|
+
/**
|
|
15
|
+
* 发送聊天消息
|
|
16
|
+
* @param talkMsg 聊天信息
|
|
17
|
+
*/
|
|
18
|
+
sendMessage(talkMsg: string, userId: string | undefined): Promise<void>;
|
|
19
|
+
addMessage(info: BMMessageInfo, isParticipantNotice: boolean): void;
|
|
20
|
+
/**
|
|
21
|
+
* 获取历史消息
|
|
22
|
+
*/
|
|
23
|
+
getHistoryMessage(): Promise<BMMessageInfo[]>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface IMessageInfo {
|
|
2
|
+
userId?: string;
|
|
3
|
+
message: string;
|
|
4
|
+
role?: string;
|
|
5
|
+
isLocal?: boolean;
|
|
6
|
+
avatar?: string;
|
|
7
|
+
nickName?: string;
|
|
8
|
+
sendTime?: number;
|
|
9
|
+
isMeetingNotice?: boolean;
|
|
10
|
+
to?: string | undefined;
|
|
11
|
+
isDanger?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export default class BMMessageInfo {
|
|
14
|
+
userId?: any;
|
|
15
|
+
message: string;
|
|
16
|
+
time: string;
|
|
17
|
+
timeStamp: number;
|
|
18
|
+
role?: string;
|
|
19
|
+
isLocal?: boolean;
|
|
20
|
+
avatar?: any;
|
|
21
|
+
nickName?: any;
|
|
22
|
+
isMeetingNotice: boolean;
|
|
23
|
+
to: string | undefined;
|
|
24
|
+
isDanger: boolean | undefined;
|
|
25
|
+
constructor(props: IMessageInfo);
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name: BMLiveVM.ts
|
|
3
|
+
* @author: yangliye
|
|
4
|
+
* @date: 2022-07-15 13:53
|
|
5
|
+
* @description:处理直播相关的流处理
|
|
6
|
+
* @update: 2022-07-15 13:53
|
|
7
|
+
*/
|
|
8
|
+
import BMRoom from "./BMRoom";
|
|
9
|
+
import BMStreamModel from "../BMStream/BMStreamModel";
|
|
10
|
+
declare class BMLiveVM {
|
|
11
|
+
private room;
|
|
12
|
+
constructor(room: BMRoom);
|
|
13
|
+
private get localBMUser();
|
|
14
|
+
private get localIsAudience();
|
|
15
|
+
/**
|
|
16
|
+
* 拉流处理
|
|
17
|
+
* @param bmStreamModel
|
|
18
|
+
*/
|
|
19
|
+
handlePull(bmStreamModel: BMStreamModel): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* 切换大小流处理
|
|
22
|
+
* @param bmStreamModel
|
|
23
|
+
*/
|
|
24
|
+
handleChangeStreamType(bmStreamModel: BMStreamModel): Promise<void>;
|
|
25
|
+
handlePlay(bmStreamModel: BMStreamModel, noPlayChanged: boolean): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* 处理观众端举手发言完了,然后在禁止发言,这个时候,没有必要在拉所有人的流,把除了混流的人的流都取消订阅,然后播放混流的声音
|
|
28
|
+
*/
|
|
29
|
+
handleAudienceDisable(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* 观众允许发言,允许发言之后,要把所有的流都拉,然后混流静音
|
|
32
|
+
*/
|
|
33
|
+
handleAudienceEnable(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export default BMLiveVM;
|
package/umd/BMRoom/BMRoom.d.ts
CHANGED
|
@@ -55,9 +55,13 @@ export default class BMRoom {
|
|
|
55
55
|
videoProfile: VideoProfile;
|
|
56
56
|
private audioProfile;
|
|
57
57
|
/**
|
|
58
|
-
* 断网重连要给端上事件响应,所有端上把流单独做处理的,需要在收到这个事件之后,重新处理所有的effect
|
|
58
|
+
* brtc断网重连要给端上事件响应,所有端上把流单独做处理的,需要在收到这个事件之后,重新处理所有的effect
|
|
59
59
|
*/
|
|
60
60
|
streamWSReconnectWatcher: Subject<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* bloud断网重连的时候的提示
|
|
63
|
+
*/
|
|
64
|
+
bloudWSReconnectWatcher: Subject<boolean>;
|
|
61
65
|
/**
|
|
62
66
|
* 会控底层相关处理, 比如是否取消自动拉流
|
|
63
67
|
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import BMUser from '../BMUser/BMUser';
|
|
2
|
+
import { SingleStream } from '../type';
|
|
3
|
+
/**
|
|
4
|
+
* @name: BMSpeaker
|
|
5
|
+
* @author: liuxinghai
|
|
6
|
+
* @date: 2022-06-07 11:41
|
|
7
|
+
* @description:BMSpeaker
|
|
8
|
+
* 适配 brtc 流对象到 bloud 流对象接口,
|
|
9
|
+
* 用户辅助采用 bloud SpeakerDetector 做说话人检测
|
|
10
|
+
* @date: 2022-06-07 11:41
|
|
11
|
+
*/
|
|
12
|
+
export default class BMSpeaker {
|
|
13
|
+
private _user;
|
|
14
|
+
private _stream;
|
|
15
|
+
private _emitter;
|
|
16
|
+
constructor(user: BMUser, stream: SingleStream);
|
|
17
|
+
/**
|
|
18
|
+
* 获取对象 ID 标识,此处使用流 ID 标识
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
getID(): string;
|
|
22
|
+
/**
|
|
23
|
+
* 获取用户 BMUser 对象
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
getUser(): BMUser;
|
|
27
|
+
/**
|
|
28
|
+
* 监听事件
|
|
29
|
+
*
|
|
30
|
+
* @param type 事件类型
|
|
31
|
+
* @param fn 事件回调
|
|
32
|
+
* @return 实例本身 {@link Client}
|
|
33
|
+
*/
|
|
34
|
+
on(type: string, fn: Function): this;
|
|
35
|
+
/**
|
|
36
|
+
* 启动音频音量检测
|
|
37
|
+
*/
|
|
38
|
+
collectAudioLevel(): void;
|
|
39
|
+
private handleAudioLevel;
|
|
40
|
+
/**
|
|
41
|
+
* 关闭音频音量检测
|
|
42
|
+
*/
|
|
43
|
+
close(): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name: getHTMLMediaStreamOptions
|
|
3
|
+
* @author: yangliye
|
|
4
|
+
* @date: 2022-09-15 14:58
|
|
5
|
+
* @description:getHTMLMediaStreamOptions
|
|
6
|
+
* @update: 2022-09-15 14:58
|
|
7
|
+
*/
|
|
8
|
+
interface Options {
|
|
9
|
+
videoElement: HTMLVideoElement;
|
|
10
|
+
}
|
|
11
|
+
export interface Result {
|
|
12
|
+
video: boolean;
|
|
13
|
+
audio: boolean;
|
|
14
|
+
videoSource: MediaStreamTrack;
|
|
15
|
+
audioSource: MediaStreamTrack;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 获取video标签中的mediaStream
|
|
21
|
+
* @param opts
|
|
22
|
+
*/
|
|
23
|
+
export declare function getHTMLMediaStreamOptions(opts: Options): Result | null;
|
|
24
|
+
export declare function getMediaStreamInfo(mediaStream: MediaStream, videoInfo: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}): {
|
|
28
|
+
video: boolean;
|
|
29
|
+
audio: boolean;
|
|
30
|
+
videoSource: MediaStreamTrack;
|
|
31
|
+
audioSource: MediaStreamTrack;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
} | null;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (target: any): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (target: any, defaultValue?: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CustomEventInterface } from '../type/type';
|
|
2
|
+
export default class CustomEvent implements CustomEventInterface {
|
|
3
|
+
static PHASE_CURRENT: number;
|
|
4
|
+
static PHASE_UPWARD: number;
|
|
5
|
+
static PHASE_DOWNWARD: number;
|
|
6
|
+
type: string;
|
|
7
|
+
phase: number;
|
|
8
|
+
ns?: string;
|
|
9
|
+
target?: any;
|
|
10
|
+
originalEvent?: CustomEventInterface | Event;
|
|
11
|
+
isPrevented?: true;
|
|
12
|
+
isStoped?: true;
|
|
13
|
+
listener?: Function;
|
|
14
|
+
/**
|
|
15
|
+
* 构造函数
|
|
16
|
+
*
|
|
17
|
+
* 可以传事件名称,也可以传原生事件对象
|
|
18
|
+
*/
|
|
19
|
+
constructor(type: string, originalEvent?: CustomEventInterface | Event);
|
|
20
|
+
/**
|
|
21
|
+
* 阻止事件的默认行为
|
|
22
|
+
*/
|
|
23
|
+
preventDefault(): this;
|
|
24
|
+
/**
|
|
25
|
+
* 停止事件广播
|
|
26
|
+
*/
|
|
27
|
+
stopPropagation(): this;
|
|
28
|
+
prevent(): this;
|
|
29
|
+
stop(): this;
|
|
30
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { NativeListener } from '../type/type';
|
|
2
|
+
import { EmitterOptions } from '../type/options';
|
|
3
|
+
declare type Namespace = {
|
|
4
|
+
type: string;
|
|
5
|
+
ns?: string;
|
|
6
|
+
};
|
|
7
|
+
export default class Emitter {
|
|
8
|
+
/**
|
|
9
|
+
* 是否开启命名空间
|
|
10
|
+
*/
|
|
11
|
+
ns: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 已注册的事件监听
|
|
14
|
+
*/
|
|
15
|
+
listeners: Record<string, EmitterOptions[]>;
|
|
16
|
+
/**
|
|
17
|
+
* 原生事件监听,一个事件对应一个 listener
|
|
18
|
+
*/
|
|
19
|
+
nativeListeners?: Record<string, NativeListener>;
|
|
20
|
+
constructor(ns?: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* 发射事件
|
|
23
|
+
*
|
|
24
|
+
* @param type 事件名称或命名空间
|
|
25
|
+
* @param args 事件处理函数的参数列表
|
|
26
|
+
* @param filter 自定义过滤器
|
|
27
|
+
*/
|
|
28
|
+
fire(type: string | Namespace, args: any[] | void, filter?: (namespace: Namespace, args: any[] | void, options: EmitterOptions) => boolean | void): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 注册监听
|
|
31
|
+
*
|
|
32
|
+
* @param type
|
|
33
|
+
* @param listener
|
|
34
|
+
*/
|
|
35
|
+
on(type: string | Namespace, listener: Function | EmitterOptions): void;
|
|
36
|
+
/**
|
|
37
|
+
* 取消监听
|
|
38
|
+
*
|
|
39
|
+
* @param type
|
|
40
|
+
* @param listener
|
|
41
|
+
*/
|
|
42
|
+
off(type?: string | Namespace, listener?: Function): void;
|
|
43
|
+
/**
|
|
44
|
+
* 是否已监听某个事件
|
|
45
|
+
*
|
|
46
|
+
* @param type
|
|
47
|
+
* @param listener
|
|
48
|
+
*/
|
|
49
|
+
has(type: string | Namespace, listener?: Function): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* 把事件类型解析成命名空间格式
|
|
52
|
+
*
|
|
53
|
+
* @param type
|
|
54
|
+
*/
|
|
55
|
+
parse(type: string): Namespace;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 遍历数组
|
|
3
|
+
*
|
|
4
|
+
* @param array
|
|
5
|
+
* @param callback 返回 false 可停止遍历
|
|
6
|
+
* @param reversed 是否逆序遍历
|
|
7
|
+
*/
|
|
8
|
+
export declare function each<T>(array: T[], callback: (item: T, index: number) => boolean | void, reversed?: boolean): void;
|
|
9
|
+
/**
|
|
10
|
+
* 往后加
|
|
11
|
+
*
|
|
12
|
+
* @param array
|
|
13
|
+
* @param target
|
|
14
|
+
*/
|
|
15
|
+
export declare function push<T>(array: T[], target: T | T[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* 往前加
|
|
18
|
+
*
|
|
19
|
+
* @param array
|
|
20
|
+
* @param target
|
|
21
|
+
*/
|
|
22
|
+
export declare function unshift<T>(array: T[], target: T | T[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* 数组项在数组中的位置
|
|
25
|
+
*
|
|
26
|
+
* @param array 数组
|
|
27
|
+
* @param target 数组项
|
|
28
|
+
* @param strict 是否全等判断,默认是全等
|
|
29
|
+
* @return 如果未找到,返回 -1
|
|
30
|
+
*/
|
|
31
|
+
export declare function indexOf<T>(array: T[], target: T, strict?: boolean): number;
|
|
32
|
+
/**
|
|
33
|
+
* 获取数组最后一项
|
|
34
|
+
*
|
|
35
|
+
* @param array 数组
|
|
36
|
+
* @return
|
|
37
|
+
*/
|
|
38
|
+
export declare function last<T>(array: T[]): T | void;
|
|
39
|
+
/**
|
|
40
|
+
* 弹出数组最后一项
|
|
41
|
+
*
|
|
42
|
+
* 项目里用的太多,仅用于节省字符...
|
|
43
|
+
*
|
|
44
|
+
* @param array 数组
|
|
45
|
+
* @return 弹出的数组项
|
|
46
|
+
*/
|
|
47
|
+
export declare function pop<T>(array: T[]): T | void;
|
|
48
|
+
/**
|
|
49
|
+
* 删除数组项
|
|
50
|
+
*
|
|
51
|
+
* @param array 数组
|
|
52
|
+
* @param item 待删除项
|
|
53
|
+
* @param strict 是否全等判断,默认是全等
|
|
54
|
+
* @return 删除的数量
|
|
55
|
+
*/
|
|
56
|
+
export declare function remove<T>(array: T[], target: T, strict?: boolean): number;
|
|
57
|
+
/**
|
|
58
|
+
* 数组是否包含 item
|
|
59
|
+
*
|
|
60
|
+
* @param array 数组
|
|
61
|
+
* @param target 可能包含的数组项
|
|
62
|
+
* @param strict 是否全等判断,默认是全等
|
|
63
|
+
* @return
|
|
64
|
+
*/
|
|
65
|
+
export declare function has<T>(array: T[], target: T, strict?: boolean): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 把类数组转成数组
|
|
68
|
+
*
|
|
69
|
+
* @param array 类数组
|
|
70
|
+
* @return
|
|
71
|
+
*/
|
|
72
|
+
export declare function toArray<T>(array: T[] | ArrayLike<T>): T[];
|
|
73
|
+
/**
|
|
74
|
+
* 把数组转成对象
|
|
75
|
+
*
|
|
76
|
+
* @param array 数组
|
|
77
|
+
* @param key 数组项包含的字段名称,如果数组项是基本类型,可不传
|
|
78
|
+
* @param value
|
|
79
|
+
* @return
|
|
80
|
+
*/
|
|
81
|
+
export declare function toObject(array: any[], key?: string | null, value?: any): object;
|
|
82
|
+
/**
|
|
83
|
+
* 把数组合并成字符串
|
|
84
|
+
*
|
|
85
|
+
* @param array
|
|
86
|
+
* @param separator
|
|
87
|
+
* @return
|
|
88
|
+
*/
|
|
89
|
+
export declare function join(array: string[], separator: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* 用于判断长度大于 0 的数组
|
|
92
|
+
*
|
|
93
|
+
* @param array
|
|
94
|
+
* @return
|
|
95
|
+
*/
|
|
96
|
+
export declare function falsy(array: any): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 为了压缩,定义的常量
|
|
3
|
+
*/
|
|
4
|
+
export declare const TRUE = true;
|
|
5
|
+
export declare const FALSE = false;
|
|
6
|
+
export declare const NULL: null;
|
|
7
|
+
export declare const UNDEFINED: undefined;
|
|
8
|
+
export declare const MINUS_ONE = -1;
|
|
9
|
+
export declare const RAW_TRUE = "true";
|
|
10
|
+
export declare const RAW_FALSE = "false";
|
|
11
|
+
export declare const RAW_NULL = "null";
|
|
12
|
+
export declare const RAW_UNDEFINED = "undefined";
|
|
13
|
+
export declare const RAW_THIS = "this";
|
|
14
|
+
export declare const RAW_VALUE = "value";
|
|
15
|
+
export declare const RAW_LENGTH = "length";
|
|
16
|
+
export declare const RAW_FUNCTION = "function";
|
|
17
|
+
export declare const RAW_WILDCARD = "*";
|
|
18
|
+
export declare const RAW_DOT = ".";
|
|
19
|
+
export declare const RAW_SLASH = "/";
|
|
20
|
+
export declare const RAW_TAG = "tag";
|
|
21
|
+
export declare const KEYPATH_PARENT = "..";
|
|
22
|
+
export declare const KEYPATH_CURRENT = "this";
|
|
23
|
+
/**
|
|
24
|
+
* Single instance for window in browser
|
|
25
|
+
*/
|
|
26
|
+
export declare const WINDOW: (Window & typeof globalThis) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Single instance for document in browser
|
|
29
|
+
*/
|
|
30
|
+
export declare const DOCUMENT: Document | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Single instance for global in nodejs or browser
|
|
33
|
+
*/
|
|
34
|
+
export declare const GLOBAL: typeof globalThis | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Single instance for noop function
|
|
37
|
+
*/
|
|
38
|
+
export declare const EMPTY_FUNCTION: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* 空对象,很多地方会用到,比如 `a || EMPTY_OBJECT` 确保是个对象
|
|
41
|
+
*/
|
|
42
|
+
export declare const EMPTY_OBJECT: Readonly<{}>;
|
|
43
|
+
/**
|
|
44
|
+
* 空数组
|
|
45
|
+
*/
|
|
46
|
+
export declare const EMPTY_ARRAY: readonly never[];
|
|
47
|
+
/**
|
|
48
|
+
* 空字符串
|
|
49
|
+
*/
|
|
50
|
+
export declare const EMPTY_STRING = "";
|