floating-live 0.15.0-beta.6 → 0.15.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/LiveRoom.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare abstract class LiveRoom extends EventEmitter implements RoomInfo
|
|
|
37
37
|
protected onDestroy?(): void;
|
|
38
38
|
/** 销毁 */
|
|
39
39
|
destroy(): void;
|
|
40
|
-
protected
|
|
40
|
+
protected emitMessage(msg: Message.All): void;
|
|
41
41
|
protected emitRaw(msg: any): void;
|
|
42
42
|
get info(): RoomInfo;
|
|
43
43
|
get key(): string;
|
package/dist/core/LiveRoom.js
CHANGED
|
@@ -24,7 +24,7 @@ class LiveRoom extends events_1.EventEmitter {
|
|
|
24
24
|
this.onDestroy?.();
|
|
25
25
|
}
|
|
26
26
|
// 发送消息
|
|
27
|
-
|
|
27
|
+
emitMessage(msg) {
|
|
28
28
|
// 其他消息 => 先更改状态再发送消息
|
|
29
29
|
// 直播结束消息 => 先发送消息再更改状态
|
|
30
30
|
switch (msg.type) {
|
|
@@ -48,13 +48,13 @@ class LiveRoom extends events_1.EventEmitter {
|
|
|
48
48
|
case "live_cut":
|
|
49
49
|
this.status = msg.status || enums_1.RoomStatus.off;
|
|
50
50
|
this.timestamp = msg.timestamp;
|
|
51
|
-
this.emit("
|
|
51
|
+
this.emit("message", msg);
|
|
52
52
|
this.emit("status", msg.status || enums_1.RoomStatus.off, {
|
|
53
53
|
timestamp: msg.timestamp,
|
|
54
54
|
});
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
this.emit("
|
|
57
|
+
this.emit("message", msg);
|
|
58
58
|
}
|
|
59
59
|
// 发送源消息
|
|
60
60
|
emitRaw(msg) {
|
package/dist/module/room.js
CHANGED
|
@@ -26,7 +26,7 @@ class ModRoom {
|
|
|
26
26
|
this.list.set(key, room);
|
|
27
27
|
// 添加监听事件
|
|
28
28
|
// 直播消息
|
|
29
|
-
room.on("
|
|
29
|
+
room.on("message", (data) => {
|
|
30
30
|
this.main.hook.call("message", data).then((res) => {
|
|
31
31
|
res && this.main.emit("live:message", data);
|
|
32
32
|
});
|
|
@@ -35,9 +35,13 @@ class ModRoom {
|
|
|
35
35
|
room.on("raw", (data, { platform, room }) => {
|
|
36
36
|
this.main.emit("live:raw", data, { platform, room });
|
|
37
37
|
});
|
|
38
|
+
// 正在连接服务器
|
|
39
|
+
room.on("connecting", () => {
|
|
40
|
+
this.main.emit("room:connecting", key);
|
|
41
|
+
});
|
|
38
42
|
// 连接到服务器
|
|
39
|
-
room.on("
|
|
40
|
-
this.main.emit("room:
|
|
43
|
+
room.on("connected", () => {
|
|
44
|
+
this.main.emit("room:connected", key);
|
|
41
45
|
});
|
|
42
46
|
// 与服务器的连接已断开
|
|
43
47
|
room.on("disconnect", () => {
|
package/dist/types/events.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export interface FloatingEventMap {
|
|
|
7
7
|
platform: string;
|
|
8
8
|
room: string | number;
|
|
9
9
|
}) => void;
|
|
10
|
-
"room:
|
|
10
|
+
"room:connecting": (key: string) => void;
|
|
11
|
+
"room:connected": (key: string) => void;
|
|
11
12
|
"room:enter": (key: string) => void;
|
|
12
13
|
"room:disconnect": (key: string) => void;
|
|
13
14
|
"room:info": (key: string, info: RoomInfo) => void;
|