@momo2555/koppeliajs 0.0.139 → 0.0.140
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.
|
@@ -13,13 +13,15 @@ export declare enum PeerType {
|
|
|
13
13
|
export declare enum MessageType {
|
|
14
14
|
EMPTY = "empty",
|
|
15
15
|
REQUEST = "request",
|
|
16
|
+
STREAM_RESPONSE = "stream_response",
|
|
16
17
|
RESPONSE = "response",
|
|
17
18
|
DATA_EXCHANGE = "data_exchange",
|
|
18
19
|
DEVICE_EVENT = "device_event",
|
|
19
20
|
DEVICE_DATA = "device_data",
|
|
20
21
|
IDENTIFICATION = "identification",
|
|
21
22
|
MODULE_ENABLE = "module_enable",
|
|
22
|
-
ERROR = "error"
|
|
23
|
+
ERROR = "error",
|
|
24
|
+
CLOSE = "close"
|
|
23
25
|
}
|
|
24
26
|
type MessagetHeader = {
|
|
25
27
|
id: string;
|
package/dist/scripts/message.js
CHANGED
|
@@ -14,6 +14,7 @@ export var MessageType;
|
|
|
14
14
|
(function (MessageType) {
|
|
15
15
|
MessageType["EMPTY"] = "empty";
|
|
16
16
|
MessageType["REQUEST"] = "request";
|
|
17
|
+
MessageType["STREAM_RESPONSE"] = "stream_response";
|
|
17
18
|
MessageType["RESPONSE"] = "response";
|
|
18
19
|
MessageType["DATA_EXCHANGE"] = "data_exchange";
|
|
19
20
|
MessageType["DEVICE_EVENT"] = "device_event";
|
|
@@ -21,6 +22,7 @@ export var MessageType;
|
|
|
21
22
|
MessageType["IDENTIFICATION"] = "identification";
|
|
22
23
|
MessageType["MODULE_ENABLE"] = "module_enable";
|
|
23
24
|
MessageType["ERROR"] = "error";
|
|
25
|
+
MessageType["CLOSE"] = "close";
|
|
24
26
|
})(MessageType || (MessageType = {}));
|
|
25
27
|
/**
|
|
26
28
|
* The koppelia protocol
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
declare class AudioInstance {
|
|
2
|
+
private audio?;
|
|
3
|
+
private id;
|
|
4
|
+
protected path: string;
|
|
5
|
+
private loop;
|
|
6
|
+
constructor(id: string, loop?: boolean);
|
|
7
|
+
fetch(): void;
|
|
8
|
+
play(): void;
|
|
9
|
+
pause(): void;
|
|
10
|
+
stop(): void;
|
|
11
|
+
setLoop(loop: boolean): void;
|
|
12
|
+
isPlaying(): boolean | undefined;
|
|
13
|
+
getId(): string;
|
|
14
|
+
getDuration(): number | undefined;
|
|
15
|
+
}
|
|
1
16
|
export declare class AudioManager {
|
|
2
17
|
private players;
|
|
3
18
|
/**
|
|
@@ -24,5 +39,7 @@ export declare class AudioManager {
|
|
|
24
39
|
* Check if a specific audio is playing
|
|
25
40
|
*/
|
|
26
41
|
isPlaying(id: string): boolean;
|
|
42
|
+
getPlayerInstance(id: string): AudioInstance | undefined;
|
|
27
43
|
}
|
|
28
44
|
export declare const audioManager: import("svelte/store").Writable<AudioManager>;
|
|
45
|
+
export {};
|
|
@@ -42,6 +42,11 @@ class AudioInstance {
|
|
|
42
42
|
getId() {
|
|
43
43
|
return this.id;
|
|
44
44
|
}
|
|
45
|
+
getDuration() {
|
|
46
|
+
if (this.audio !== undefined) {
|
|
47
|
+
return this.audio?.duration;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
class AudioUrlInstance extends AudioInstance {
|
|
47
52
|
constructor(id, url, loop) {
|
|
@@ -101,6 +106,9 @@ export class AudioManager {
|
|
|
101
106
|
isPlaying(id) {
|
|
102
107
|
return this.players.get(id)?.isPlaying() ?? false;
|
|
103
108
|
}
|
|
109
|
+
getPlayerInstance(id) {
|
|
110
|
+
return this.players.get(id);
|
|
111
|
+
}
|
|
104
112
|
}
|
|
105
113
|
// Export a writable store with the AudioManager singleton
|
|
106
114
|
export const audioManager = writable(new AudioManager());
|