@dcl-regenesislabs/bevy-explorer-web 0.1.0-19174149273.commit-84abbee → 0.1.0-19361960663.commit-5c0c59e

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/.env CHANGED
@@ -1 +1 @@
1
- PUBLIC_URL="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19174149273.commit-84abbee"
1
+ PUBLIC_URL="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19361960663.commit-5c0c59e"
package/index.html CHANGED
@@ -101,7 +101,7 @@
101
101
  }
102
102
  </style>
103
103
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
104
- <script>window.PUBLIC_URL = "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19174149273.commit-84abbee";</script>
104
+ <script>window.PUBLIC_URL = "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19361960663.commit-5c0c59e";</script>
105
105
  </head>
106
106
  <body>
107
107
  <div id="header" class="container">
@@ -135,6 +135,6 @@
135
135
  </div>
136
136
  <script src="https://cdn.jsdelivr.net/npm/livekit-client/dist/livekit-client.umd.min.js"></script>
137
137
  <script src="https://cdn.jsdelivr.net/npm/hls.js@1"></script>
138
- <script type="module" src="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19174149273.commit-84abbee/main.js"></script>
138
+ <script type="module" src="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19361960663.commit-5c0c59e/main.js"></script>
139
139
  </body>
140
140
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl-regenesislabs/bevy-explorer-web",
3
- "version": "0.1.0-19174149273.commit-84abbee",
3
+ "version": "0.1.0-19361960663.commit-5c0c59e",
4
4
  "scripts": {
5
5
  "postinstall": "node ./scripts/prebuild.js"
6
6
  },
@@ -8,6 +8,6 @@
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/decentraland/bevy-explorer.git"
10
10
  },
11
- "homepage": "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19174149273.commit-84abbee",
12
- "commit": "84abbee4403d9afcde6953dba9327d892b6205bc"
11
+ "homepage": "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-19361960663.commit-5c0c59e",
12
+ "commit": "5c0c59ec4b7ead271e11452cee59d2ef04029aae"
13
13
  }
@@ -1,76 +1,139 @@
1
- let currentMicTrack = null;
1
+ function log(...args) {
2
+ console.log("[livekit]", ...args)
3
+ }
4
+ function warn(...args) {
5
+ console.warn("[livekit]", ...args)
6
+ }
7
+ function error(...args) {
8
+ console.error("[livekit]", ...args)
9
+ }
10
+
11
+ let currentMicTrack = false;
2
12
  const activeRooms = new Set();
3
13
 
4
14
  // Store audio elements and panner nodes for spatial audio
5
- const participantAudioNodes = new Map();
15
+ const trackRigs = new Map();
16
+ const participantAudioSids = new Map();
17
+ var audioContext = null;
6
18
 
7
- export async function connect_room(url, token) {
19
+ export async function connect_room(url, token, handler) {
8
20
  const room = new LivekitClient.Room({
9
- autoSubscribe: true,
10
21
  adaptiveStream: false,
11
22
  dynacast: false,
12
23
  });
13
-
14
- await room.connect(url, token);
15
-
24
+
25
+ set_room_event_handler(room, handler)
26
+
27
+ await room.connect(url, token, {
28
+ autoSubscribe: false,
29
+ });
30
+
16
31
  // Add to active rooms set
17
32
  activeRooms.add(room);
18
-
19
- // Don't automatically set up microphone - let it be controlled by the mic state
20
-
33
+
34
+ // set up microphone
35
+ if (currentMicTrack) {
36
+ log(`sub ${room.name}`);
37
+ const audioTrack = await LivekitClient.createLocalAudioTrack({
38
+ echoCancellation: true,
39
+ noiseSuppression: true,
40
+ autoGainControl: true,
41
+ });
42
+ const pub = await room.localParticipant.publishTrack(audioTrack, {
43
+ source: LivekitClient.Track.Source.Microphone,
44
+ }).catch(error => {
45
+ error(`Failed to publish to room: ${error}`);
46
+ })
47
+
48
+ // avoid race
49
+ if (!currentMicTrack) {
50
+ await room.localParticipant.unpublishTrack(pub.track);
51
+ }
52
+ }
53
+
54
+ // check existing streams
55
+ const participants = Array.from(room.remoteParticipants.values());
56
+ for (const participant of participants) {
57
+ const audioPubs = Array.from(participant.trackPublications.values())
58
+ .filter(pub => pub.kind === 'audio');
59
+ for (const publication of audioPubs) {
60
+ log(`found initial pub for ${participant}`);
61
+ handler({
62
+ type: 'trackPublished',
63
+ kind: publication.kind,
64
+ participant: {
65
+ identity: participant.identity,
66
+ metadata: participant.metadata || ''
67
+ }
68
+ })
69
+ }
70
+ }
71
+
21
72
  return room;
22
73
  }
23
74
 
24
75
  export function set_microphone_enabled(enabled) {
25
- if (activeRooms.size === 0) {
26
- console.warn('No rooms available for microphone control');
27
- return;
28
- }
29
-
30
76
  if (enabled) {
31
77
  // Enable microphone
32
78
  if (!currentMicTrack) {
33
- LivekitClient.createLocalAudioTrack({
34
- echoCancellation: true,
35
- noiseSuppression: true,
36
- autoGainControl: true,
37
- }).then(audioTrack => {
38
- currentMicTrack = audioTrack;
39
-
40
- // Publish to all active rooms
41
- const publishPromises = Array.from(activeRooms).map(room =>
42
- room.localParticipant.publishTrack(audioTrack, {
43
- source: LivekitClient.Track.Source.Microphone,
44
- }).catch(error => {
45
- console.error(`Failed to publish to room: ${error}`);
46
- })
47
- );
48
-
49
- return Promise.all(publishPromises);
50
- }).then(() => {
51
- console.log('Microphone enabled successfully for all rooms');
79
+ currentMicTrack = true;
80
+
81
+ // Publish to all active rooms
82
+ const publishPromises = Array.from(activeRooms).map(async (room) => {
83
+ log(`publish ${room.name}`);
84
+ const audioTrack = await LivekitClient.createLocalAudioTrack({
85
+ echoCancellation: true,
86
+ noiseSuppression: true,
87
+ autoGainControl: true,
88
+ });
89
+ let pub = await room.localParticipant.publishTrack(audioTrack, {
90
+ source: LivekitClient.Track.Source.Microphone,
91
+ }).catch(error => {
92
+ error(`Failed to publish to room: ${error}`);
93
+ });
94
+
95
+ // avoid race
96
+ if (!currentMicTrack) {
97
+ await room.localParticipant.unpublishTrack(pub.track);
98
+ }
99
+ });
100
+
101
+ Promise.all(publishPromises).then(() => {
102
+ log('Microphone enabled successfully for all rooms');
52
103
  }).catch(error => {
53
- console.error('Failed to enable microphone:', error);
54
- currentMicTrack = null;
104
+ error('Failed to enable microphone:', error);
55
105
  });
56
106
  }
57
107
  } else {
58
108
  // Disable microphone
59
109
  if (currentMicTrack) {
60
- // Unpublish from all active rooms
61
- const unpublishPromises = Array.from(activeRooms).map(room =>
62
- room.localParticipant.unpublishTrack(currentMicTrack).catch(error => {
63
- console.error(`Failed to unpublish from room: ${error}`);
64
- })
65
- );
66
-
67
- Promise.all(unpublishPromises).then(() => {
68
- currentMicTrack.stop();
69
- currentMicTrack = null;
70
- console.log('Microphone disabled successfully for all rooms');
71
- }).catch(error => {
72
- console.error('Failed to disable microphone:', error);
110
+ const allRoomUnpublishPromises = Array.from(activeRooms).map(async (room) => {
111
+ const audioPubs = Array.from(room.localParticipant.trackPublications.values())
112
+ .filter(pub => pub.kind === 'audio');
113
+
114
+ const roomSpecificPromises = audioPubs.map(pub => {
115
+ try {
116
+ room.localParticipant.unpublishTrack(pub.track);
117
+ log(`unpublish ${room.name}`);
118
+ } catch (error) {
119
+ error(`Failed to unpublish ${pub} from room ${room.name}:`, error);
120
+ }
121
+ });
122
+
123
+ try {
124
+ await Promise.all(roomSpecificPromises);
125
+ } catch (error) {
126
+ error(`Failed to unpublish audio from room ${room.name}:`, error);
127
+ }
73
128
  });
129
+
130
+ Promise.all(allRoomUnpublishPromises)
131
+ .catch(error => {
132
+ error('A critical error occurred during the unpublish-all process:', error);
133
+ })
134
+ .finally(() => {
135
+ currentMicTrack = false;
136
+ });
74
137
  }
75
138
  }
76
139
  }
@@ -86,7 +149,7 @@ export async function publish_data(room, data, reliable, destinations) {
86
149
  reliable: reliable,
87
150
  destination: destinations.length > 0 ? destinations : undefined,
88
151
  };
89
-
152
+
90
153
  await room.localParticipant.publishData(data, options);
91
154
  }
92
155
 
@@ -107,13 +170,18 @@ export async function unpublish_track(room, sid) {
107
170
  export async function close_room(room) {
108
171
  // Remove from active rooms set
109
172
  activeRooms.delete(room);
110
-
111
- // If this was the last room and mic is active, clean up
112
- if (activeRooms.size === 0 && currentMicTrack) {
113
- currentMicTrack.stop();
114
- currentMicTrack = null;
173
+
174
+ // If mic is active, clean up
175
+ if (currentMicTrack) {
176
+ const audioPubs = Array.from(room.localParticipant.trackPublications.values())
177
+ .filter(pub => pub.kind === 'audio');
178
+
179
+ for (const pub of audioPubs) {
180
+ log(`stop ${room.name} on exit`);
181
+ pub.track.stop();
182
+ }
115
183
  }
116
-
184
+
117
185
  await room.disconnect();
118
186
  }
119
187
 
@@ -128,37 +196,92 @@ export function set_room_event_handler(room, handler) {
128
196
  }
129
197
  });
130
198
  });
131
-
199
+
200
+ room.on(LivekitClient.RoomEvent.TrackPublished, (publication, participant) => {
201
+ log(`${room.name} ${participant.identity} rec pub ${publication.kind}`);
202
+ handler({
203
+ type: 'trackPublished',
204
+ kind: publication.kind,
205
+ participant: {
206
+ identity: participant.identity,
207
+ metadata: participant.metadata || ''
208
+ }
209
+ })
210
+ });
211
+
212
+ room.on(LivekitClient.RoomEvent.TrackUnpublished, (publication, participant) => {
213
+ log(`${room.name} ${participant.identity} rec unpub ${publication.kind}`);
214
+
215
+ const key = publication.trackSid;
216
+ const rig = trackRigs.get(key);
217
+
218
+ if (rig) {
219
+ log(`cleaning up audio rig for track: ${key}`);
220
+
221
+ rig.source.disconnect();
222
+ rig.pannerNode.disconnect();
223
+ rig.gainNode.disconnect();
224
+
225
+ trackRigs.delete(key);
226
+ } else {
227
+ log(`no cleanup for ${key}`);
228
+ }
229
+
230
+ handler({
231
+ type: 'trackUnpublished',
232
+ kind: publication.kind,
233
+ participant: {
234
+ identity: participant.identity,
235
+ metadata: participant.metadata || ''
236
+ }
237
+ })
238
+ });
239
+
132
240
  room.on(LivekitClient.RoomEvent.TrackSubscribed, (track, publication, participant) => {
241
+ log(`${room.name} ${participant.identity} rec sub ${publication.kind} (track sid ${track.sid})`);
133
242
  // For audio tracks, set up spatial audio
134
243
  if (track.kind === 'audio') {
135
- const audioElement = track.attach();
136
-
137
- // Create Web Audio API nodes for spatial audio
138
- const audioContext = new (window.AudioContext || window.webkitAudioContext)();
139
- const source = audioContext.createMediaElementSource(audioElement);
140
- const pannerNode = audioContext.createStereoPanner();
141
- const gainNode = audioContext.createGain();
142
-
143
- // Connect the audio graph: source -> panner -> gain -> destination
144
- source.connect(pannerNode);
145
- pannerNode.connect(gainNode);
146
- gainNode.connect(audioContext.destination);
147
-
148
- // Store the nodes for later control
149
- participantAudioNodes.set(participant.identity, {
150
- audioElement,
151
- audioContext,
152
- source,
153
- pannerNode,
154
- gainNode,
155
- track
156
- });
157
-
158
- // Start playing
159
- audioElement.play().catch(e => console.warn('Failed to play audio:', e));
244
+ if (!audioContext) {
245
+ audioContext = new (window.AudioContext || window.webkitAudioContext)();
246
+ }
247
+
248
+ const key = track.sid;
249
+
250
+ if (!trackRigs.has(key)) {
251
+ log("create nodes for", key);
252
+
253
+ // dummy audioElement
254
+ const audioElement = track.attach();
255
+ audioElement.volume = 0;
256
+
257
+ // use the track internal stream in playback
258
+ const stream = new MediaStream([track.mediaStreamTrack]);
259
+ const source = audioContext.createMediaStreamSource(stream);
260
+ const pannerNode = audioContext.createStereoPanner();
261
+ const gainNode = audioContext.createGain();
262
+
263
+ // Connect the audio graph: source -> panner -> gain -> destination
264
+ source.connect(pannerNode);
265
+ pannerNode.connect(gainNode);
266
+ gainNode.connect(audioContext.destination);
267
+
268
+ // Store the nodes for later control
269
+ trackRigs.set(key, {
270
+ audioElement,
271
+ source,
272
+ pannerNode,
273
+ gainNode,
274
+ stream,
275
+ });
276
+ }
277
+
278
+ const audioElement = trackRigs.get(key).audioElement;
279
+ audioElement.play(); // we have to do this to get the stream to start pumping
280
+
281
+ log(`set rig for ${participant.identity}`, key);
282
+ participantAudioSids.set(participant.identity, { room: room.name, audio: key })
160
283
  }
161
-
284
+
162
285
  handler({
163
286
  type: 'trackSubscribed',
164
287
  participant: {
@@ -167,21 +290,24 @@ export function set_room_event_handler(room, handler) {
167
290
  }
168
291
  });
169
292
  });
170
-
293
+
171
294
  room.on(LivekitClient.RoomEvent.TrackUnsubscribed, (track, publication, participant) => {
172
- // Clean up spatial audio nodes
173
- if (track.kind === 'audio') {
174
- const nodes = participantAudioNodes.get(participant.identity);
175
- if (nodes) {
176
- nodes.source.disconnect();
177
- nodes.pannerNode.disconnect();
178
- nodes.gainNode.disconnect();
179
- nodes.audioContext.close();
180
- track.detach(nodes.audioElement);
181
- participantAudioNodes.delete(participant.identity);
182
- }
295
+ log(`${room.name} ${participant.identity} rec unsub ${publication.kind} (track sid ${track.sid})`);
296
+ if (participantAudioSids.get(participant.identity)?.room === room.name) {
297
+ log(`delete lookup for ${participant.identity}`);
298
+ participantAudioSids.delete(participant.identity);
183
299
  }
184
-
300
+
301
+ const key = track.sid;
302
+
303
+ if (!trackRigs.has(key)) {
304
+ log(`detach and pause audioElement for ${key}`)
305
+ const audioElement = trackRigs(key).audioElement;
306
+ track.detach(audioElement);
307
+ audioElement.pause();
308
+ }
309
+
310
+
185
311
  handler({
186
312
  type: 'trackUnsubscribed',
187
313
  participant: {
@@ -190,7 +316,7 @@ export function set_room_event_handler(room, handler) {
190
316
  }
191
317
  });
192
318
  });
193
-
319
+
194
320
  room.on(LivekitClient.RoomEvent.ParticipantConnected, (participant) => {
195
321
  handler({
196
322
  type: 'participantConnected',
@@ -200,18 +326,9 @@ export function set_room_event_handler(room, handler) {
200
326
  }
201
327
  });
202
328
  });
203
-
329
+
204
330
  room.on(LivekitClient.RoomEvent.ParticipantDisconnected, (participant) => {
205
- // Clean up any audio nodes when participant disconnects
206
- const nodes = participantAudioNodes.get(participant.identity);
207
- if (nodes) {
208
- nodes.source.disconnect();
209
- nodes.pannerNode.disconnect();
210
- nodes.gainNode.disconnect();
211
- nodes.audioContext.close();
212
- participantAudioNodes.delete(participant.identity);
213
- }
214
-
331
+ participantAudioSids.delete(participant.identity);
215
332
  handler({
216
333
  type: 'participantDisconnected',
217
334
  participant: {
@@ -224,47 +341,67 @@ export function set_room_event_handler(room, handler) {
224
341
 
225
342
  // Spatial audio control functions
226
343
  export function set_participant_spatial_audio(participantIdentity, pan, volume) {
227
- const nodes = participantAudioNodes.get(participantIdentity);
228
- if (nodes) {
229
- // Pan value should be between -1 (left) and 1 (right)
230
- nodes.pannerNode.pan.value = Math.max(-1, Math.min(1, pan));
231
- // Volume should be between 0 and 1 (or higher for boost)
232
- nodes.gainNode.gain.value = Math.max(0, volume);
233
-
234
- console.log(`Set spatial audio for ${participantIdentity}: pan=${pan}, volume=${volume}`);
344
+ const participantAudio = participantAudioSids.get(participantIdentity);
345
+ if (!participantAudio) {
346
+ log(`no rig for ${participantIdentity}`)
347
+ return;
235
348
  }
236
- }
237
349
 
238
- // Set pan value only (-1 to 1, where -1 is left, 0 is center, 1 is right)
239
- export function set_participant_pan(participantIdentity, pan) {
240
- const nodes = participantAudioNodes.get(participantIdentity);
241
- if (nodes) {
242
- nodes.pannerNode.pan.value = Math.max(-1, Math.min(1, pan));
350
+ const nodes = trackRigs.get(participantAudio.audio);
351
+ if (!nodes) {
352
+ error(`no nodes for participant ${participantIdentity}, this should never happen`, audio);
353
+ error("rigs:", trackRigs);
354
+ return;
243
355
  }
244
- }
245
356
 
246
- // Set volume only (0 to 1, or higher for boost)
247
- export function set_participant_volume(participantIdentity, volume) {
248
- const nodes = participantAudioNodes.get(participantIdentity);
249
- if (nodes) {
250
- nodes.gainNode.gain.value = Math.max(0, volume);
251
- }
357
+ // Pan value should be between -1 (left) and 1 (right)
358
+ nodes.pannerNode.pan.value = Math.max(-1, Math.min(1, pan));
359
+ // Volume should be between 0 and 1 (or higher for boost)
360
+ nodes.gainNode.gain.value = Math.max(0, volume);
361
+
362
+ // nodes.analyser.getByteTimeDomainData(nodes.dataArray);
363
+
364
+ // // Check if all values are '128' (which is digital silence)
365
+ // let isSilent = true;
366
+ // for (let i = 0; i < nodes.dataArray.length; i++) {
367
+ // if (nodes.dataArray[i] !== 128) {
368
+ // isSilent = false;
369
+ // break;
370
+ // }
371
+ // }
372
+
373
+ // log(`[${audioContext.state}] Set spatial audio for ${participantIdentity} : pan=${nodes.pannerNode.pan.value}, volume=${nodes.gainNode.gain.value}`);
252
374
  }
253
375
 
254
376
  // Get all active participant identities with audio
255
377
  export function get_audio_participants() {
256
- return Array.from(participantAudioNodes.keys());
378
+ return Array.from(participantAudioSids.keys());
257
379
  }
258
380
 
259
- // Helper function to clean up audio resources
260
- export function cleanup_audio_track(track) {
261
- if (track._audioContext) {
262
- track._audioContext.close();
381
+ export function subscribe_channel(roomName, participantId, subscribe) {
382
+ const room = Array.from(activeRooms).find(room => room.name === roomName);
383
+ if (!room) {
384
+ warn(`couldn't find room ${roomName} for subscription`);
385
+ return;
263
386
  }
264
- if (track._scriptNode) {
265
- track._scriptNode.disconnect();
387
+
388
+ const participant = room.remoteParticipants.get(participantId);
389
+ if (!participant) {
390
+ warn(`couldn't find participant ${participantId} in room ${roomName} for subscription`);
391
+ return;
266
392
  }
267
- if (track._audioElement) {
268
- track.detach(track._audioElement);
393
+
394
+ const audioPubs = Array.from(participant.trackPublications.values())
395
+ .filter(pub => pub.kind === 'audio');
396
+
397
+ log(`subscribing to ${audioPubs.length} audio tracks`);
398
+
399
+ for (const pub of audioPubs) {
400
+ log(`sub ${roomName}-${participantId}`);
401
+ pub.setSubscribed(subscribe);
269
402
  }
270
403
  }
404
+
405
+ export function room_name(room) {
406
+ return room.name
407
+ }
@@ -81,6 +81,8 @@ export function op_get_permission_types(arg0: WorkerContext): Array<any>;
81
81
  export function op_set_interactable_area(state: WorkerContext, left: number, top: number, right: number, bottom: number): void;
82
82
  export function op_get_mic_state(state: WorkerContext): Promise<any>;
83
83
  export function op_set_mic_enabled(state: WorkerContext, enabled: boolean): Promise<void>;
84
+ export function op_get_voice_stream(state: WorkerContext): Promise<number>;
85
+ export function op_read_voice_stream(state: WorkerContext, rid: number): Promise<any>;
84
86
  export function op_testing_enabled(op_state: WorkerContext): boolean;
85
87
  export function op_log_test_plan(state: WorkerContext, body: any): void;
86
88
  export function op_log_test_result(state: WorkerContext, body: any): void;
@@ -180,6 +182,8 @@ export interface InitOutput {
180
182
  readonly op_set_interactable_area: (a: number, b: number, c: number, d: number, e: number) => void;
181
183
  readonly op_get_mic_state: (a: number) => any;
182
184
  readonly op_set_mic_enabled: (a: number, b: number) => any;
185
+ readonly op_get_voice_stream: (a: number) => any;
186
+ readonly op_read_voice_stream: (a: number, b: number) => any;
183
187
  readonly op_testing_enabled: (a: number) => number;
184
188
  readonly op_log_test_plan: (a: number, b: any) => void;
185
189
  readonly op_log_test_result: (a: number, b: any) => void;
@@ -205,18 +209,18 @@ export interface InitOutput {
205
209
  readonly __externref_drop_slice: (a: number, b: number) => void;
206
210
  readonly __externref_table_dealloc: (a: number) => void;
207
211
  readonly closure15250_externref_shim: (a: number, b: number, c: number, d: any) => void;
208
- readonly closure47650_externref_shim: (a: number, b: number, c: any) => void;
212
+ readonly closure47751_externref_shim: (a: number, b: number, c: any) => void;
209
213
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__haf6d1d6eca19ebd1: (a: number, b: number) => void;
210
214
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h88ef16e697def3fb: (a: number, b: number) => void;
211
- readonly closure51472_externref_shim: (a: number, b: number, c: any) => void;
215
+ readonly closure51579_externref_shim: (a: number, b: number, c: any) => void;
212
216
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9bfa50ac2770910f: (a: number, b: number) => void;
213
217
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heedd0a6395901798: (a: number, b: number) => void;
214
- readonly closure56515_externref_shim: (a: number, b: number, c: any) => void;
218
+ readonly closure56622_externref_shim: (a: number, b: number, c: any) => void;
215
219
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0c78161a9a71767b: (a: number, b: number) => void;
216
- readonly closure56528_externref_shim: (a: number, b: number, c: any, d: any) => void;
217
- readonly closure116688_externref_shim: (a: number, b: number, c: any) => void;
218
- readonly closure131719_externref_shim: (a: number, b: number, c: any) => void;
219
- readonly closure134623_externref_shim: (a: number, b: number, c: any, d: any) => void;
220
+ readonly closure56635_externref_shim: (a: number, b: number, c: any, d: any) => void;
221
+ readonly closure116795_externref_shim: (a: number, b: number, c: any) => void;
222
+ readonly closure131826_externref_shim: (a: number, b: number, c: any) => void;
223
+ readonly closure134730_externref_shim: (a: number, b: number, c: any, d: any) => void;
220
224
  readonly __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
221
225
  readonly __wbindgen_start: (a: number) => void;
222
226
  }
@@ -1,4 +1,4 @@
1
- import { close_room, connect_room, is_microphone_available, publish_data, set_microphone_enabled, set_room_event_handler } from './snippets/comms-53217a45365bb5fa/livekit_web_bindings.js';
1
+ import { close_room, connect_room, is_microphone_available, publish_data, room_name, set_microphone_enabled, set_participant_spatial_audio, subscribe_channel } from './snippets/comms-53217a45365bb5fa/livekit_web_bindings.js';
2
2
 
3
3
  const lAudioContext = (typeof AudioContext !== 'undefined' ? AudioContext : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : undefined));
4
4
  let wasm;
@@ -1170,6 +1170,27 @@ export function op_set_mic_enabled(state, enabled) {
1170
1170
  return ret;
1171
1171
  }
1172
1172
 
1173
+ /**
1174
+ * @param {WorkerContext} state
1175
+ * @returns {Promise<number>}
1176
+ */
1177
+ export function op_get_voice_stream(state) {
1178
+ _assertClass(state, WorkerContext);
1179
+ const ret = wasm.op_get_voice_stream(state.__wbg_ptr);
1180
+ return ret;
1181
+ }
1182
+
1183
+ /**
1184
+ * @param {WorkerContext} state
1185
+ * @param {number} rid
1186
+ * @returns {Promise<any>}
1187
+ */
1188
+ export function op_read_voice_stream(state, rid) {
1189
+ _assertClass(state, WorkerContext);
1190
+ const ret = wasm.op_read_voice_stream(state.__wbg_ptr, rid);
1191
+ return ret;
1192
+ }
1193
+
1173
1194
  /**
1174
1195
  * @param {WorkerContext} op_state
1175
1196
  * @returns {boolean}
@@ -1320,7 +1341,7 @@ function __wbg_adapter_62(arg0, arg1, arg2, arg3) {
1320
1341
  }
1321
1342
 
1322
1343
  function __wbg_adapter_65(arg0, arg1, arg2) {
1323
- wasm.closure47650_externref_shim(arg0, arg1, arg2);
1344
+ wasm.closure47751_externref_shim(arg0, arg1, arg2);
1324
1345
  }
1325
1346
 
1326
1347
  function __wbg_adapter_68(arg0, arg1) {
@@ -1332,7 +1353,7 @@ function __wbg_adapter_71(arg0, arg1) {
1332
1353
  }
1333
1354
 
1334
1355
  function __wbg_adapter_74(arg0, arg1, arg2) {
1335
- wasm.closure51472_externref_shim(arg0, arg1, arg2);
1356
+ wasm.closure51579_externref_shim(arg0, arg1, arg2);
1336
1357
  }
1337
1358
 
1338
1359
  function __wbg_adapter_81(arg0, arg1) {
@@ -1344,7 +1365,7 @@ function __wbg_adapter_84(arg0, arg1) {
1344
1365
  }
1345
1366
 
1346
1367
  function __wbg_adapter_87(arg0, arg1, arg2) {
1347
- wasm.closure56515_externref_shim(arg0, arg1, arg2);
1368
+ wasm.closure56622_externref_shim(arg0, arg1, arg2);
1348
1369
  }
1349
1370
 
1350
1371
  function __wbg_adapter_98(arg0, arg1) {
@@ -1352,19 +1373,19 @@ function __wbg_adapter_98(arg0, arg1) {
1352
1373
  }
1353
1374
 
1354
1375
  function __wbg_adapter_105(arg0, arg1, arg2, arg3) {
1355
- wasm.closure56528_externref_shim(arg0, arg1, arg2, arg3);
1376
+ wasm.closure56635_externref_shim(arg0, arg1, arg2, arg3);
1356
1377
  }
1357
1378
 
1358
1379
  function __wbg_adapter_108(arg0, arg1, arg2) {
1359
- wasm.closure116688_externref_shim(arg0, arg1, arg2);
1380
+ wasm.closure116795_externref_shim(arg0, arg1, arg2);
1360
1381
  }
1361
1382
 
1362
1383
  function __wbg_adapter_111(arg0, arg1, arg2) {
1363
- wasm.closure131719_externref_shim(arg0, arg1, arg2);
1384
+ wasm.closure131826_externref_shim(arg0, arg1, arg2);
1364
1385
  }
1365
1386
 
1366
- function __wbg_adapter_1523(arg0, arg1, arg2, arg3) {
1367
- wasm.closure134623_externref_shim(arg0, arg1, arg2, arg3);
1387
+ function __wbg_adapter_1529(arg0, arg1, arg2, arg3) {
1388
+ wasm.closure134730_externref_shim(arg0, arg1, arg2, arg3);
1368
1389
  }
1369
1390
 
1370
1391
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -1703,8 +1724,8 @@ function __wbg_get_imports() {
1703
1724
  const ret = arg0.connected;
1704
1725
  return ret;
1705
1726
  };
1706
- imports.wbg.__wbg_connectroom_663acb09066a2ceb = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1707
- const ret = connect_room(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
1727
+ imports.wbg.__wbg_connectroom_18dbd6fca6118503 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1728
+ const ret = connect_room(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4);
1708
1729
  return ret;
1709
1730
  }, arguments) };
1710
1731
  imports.wbg.__wbg_contains_3361c7eda6c95afd = function(arg0, arg1) {
@@ -2661,7 +2682,7 @@ function __wbg_get_imports() {
2661
2682
  const a = state0.a;
2662
2683
  state0.a = 0;
2663
2684
  try {
2664
- return __wbg_adapter_1523(a, state0.b, arg0, arg1);
2685
+ return __wbg_adapter_1529(a, state0.b, arg0, arg1);
2665
2686
  } finally {
2666
2687
  state0.a = a;
2667
2688
  }
@@ -3034,6 +3055,13 @@ function __wbg_get_imports() {
3034
3055
  imports.wbg.__wbg_revokeObjectURL_27267efebeb457c7 = function() { return handleError(function (arg0, arg1) {
3035
3056
  URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
3036
3057
  }, arguments) };
3058
+ imports.wbg.__wbg_roomname_c2df33489bff49c5 = function(arg0, arg1) {
3059
+ const ret = room_name(arg1);
3060
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3061
+ const len1 = WASM_VECTOR_LEN;
3062
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3063
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3064
+ };
3037
3065
  imports.wbg.__wbg_scheduler_48482a9974eeacbd = function(arg0) {
3038
3066
  const ret = arg0.scheduler;
3039
3067
  return ret;
@@ -3609,6 +3637,9 @@ function __wbg_get_imports() {
3609
3637
  imports.wbg.__wbg_setorigin_b60c336116473e0b = function(arg0, arg1) {
3610
3638
  arg0.origin = arg1;
3611
3639
  };
3640
+ imports.wbg.__wbg_setparticipantspatialaudio_eaa8145141030980 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
3641
+ set_participant_spatial_audio(getStringFromWasm0(arg0, arg1), arg2, arg3);
3642
+ }, arguments) };
3612
3643
  imports.wbg.__wbg_setpassop_238c7cbc20505ae9 = function(arg0, arg1) {
3613
3644
  arg0.passOp = __wbindgen_enum_GpuStencilOperation[arg1];
3614
3645
  };
@@ -3639,9 +3670,6 @@ function __wbg_get_imports() {
3639
3670
  imports.wbg.__wbg_setresource_5a4cc69a127b394e = function(arg0, arg1) {
3640
3671
  arg0.resource = arg1;
3641
3672
  };
3642
- imports.wbg.__wbg_setroomeventhandler_2ae9ef9b4b073965 = function() { return handleError(function (arg0, arg1) {
3643
- set_room_event_handler(arg0, arg1);
3644
- }, arguments) };
3645
3673
  imports.wbg.__wbg_setrowsperimage_678794ed5e8f43cd = function(arg0, arg1) {
3646
3674
  arg0.rowsPerImage = arg1 >>> 0;
3647
3675
  };
@@ -3984,6 +4012,9 @@ function __wbg_get_imports() {
3984
4012
  imports.wbg.__wbg_submit_522f9e0b9d7e22fd = function(arg0, arg1) {
3985
4013
  arg0.submit(arg1);
3986
4014
  };
4015
+ imports.wbg.__wbg_subscribechannel_dfcde151f0fd76ef = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4016
+ subscribe_channel(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4 !== 0);
4017
+ }, arguments) };
3987
4018
  imports.wbg.__wbg_text_7805bea50de2af49 = function() { return handleError(function (arg0) {
3988
4019
  const ret = arg0.text();
3989
4020
  return ret;
@@ -4172,88 +4203,88 @@ function __wbg_get_imports() {
4172
4203
  const ret = false;
4173
4204
  return ret;
4174
4205
  };
4175
- imports.wbg.__wbindgen_closure_wrapper149437 = function(arg0, arg1, arg2) {
4176
- const ret = makeMutClosure(arg0, arg1, 116689, __wbg_adapter_108);
4206
+ imports.wbg.__wbindgen_closure_wrapper149587 = function(arg0, arg1, arg2) {
4207
+ const ret = makeMutClosure(arg0, arg1, 116796, __wbg_adapter_108);
4177
4208
  return ret;
4178
4209
  };
4179
- imports.wbg.__wbindgen_closure_wrapper169888 = function(arg0, arg1, arg2) {
4180
- const ret = makeMutClosure(arg0, arg1, 131720, __wbg_adapter_111);
4210
+ imports.wbg.__wbindgen_closure_wrapper170038 = function(arg0, arg1, arg2) {
4211
+ const ret = makeMutClosure(arg0, arg1, 131827, __wbg_adapter_111);
4181
4212
  return ret;
4182
4213
  };
4183
- imports.wbg.__wbindgen_closure_wrapper169890 = function(arg0, arg1, arg2) {
4184
- const ret = makeMutClosure(arg0, arg1, 131720, __wbg_adapter_111);
4214
+ imports.wbg.__wbindgen_closure_wrapper170040 = function(arg0, arg1, arg2) {
4215
+ const ret = makeMutClosure(arg0, arg1, 131827, __wbg_adapter_111);
4185
4216
  return ret;
4186
4217
  };
4187
- imports.wbg.__wbindgen_closure_wrapper20134 = function(arg0, arg1, arg2) {
4218
+ imports.wbg.__wbindgen_closure_wrapper20137 = function(arg0, arg1, arg2) {
4188
4219
  const ret = makeMutClosure(arg0, arg1, 15251, __wbg_adapter_62);
4189
4220
  return ret;
4190
4221
  };
4191
- imports.wbg.__wbindgen_closure_wrapper64006 = function(arg0, arg1, arg2) {
4192
- const ret = makeMutClosure(arg0, arg1, 47651, __wbg_adapter_65);
4222
+ imports.wbg.__wbindgen_closure_wrapper64148 = function(arg0, arg1, arg2) {
4223
+ const ret = makeMutClosure(arg0, arg1, 47752, __wbg_adapter_65);
4193
4224
  return ret;
4194
4225
  };
4195
- imports.wbg.__wbindgen_closure_wrapper64194 = function(arg0, arg1, arg2) {
4196
- const ret = makeMutClosure(arg0, arg1, 47756, __wbg_adapter_68);
4226
+ imports.wbg.__wbindgen_closure_wrapper64336 = function(arg0, arg1, arg2) {
4227
+ const ret = makeMutClosure(arg0, arg1, 47857, __wbg_adapter_68);
4197
4228
  return ret;
4198
4229
  };
4199
- imports.wbg.__wbindgen_closure_wrapper68212 = function(arg0, arg1, arg2) {
4200
- const ret = makeMutClosure(arg0, arg1, 50826, __wbg_adapter_71);
4230
+ imports.wbg.__wbindgen_closure_wrapper68361 = function(arg0, arg1, arg2) {
4231
+ const ret = makeMutClosure(arg0, arg1, 50933, __wbg_adapter_71);
4201
4232
  return ret;
4202
4233
  };
4203
- imports.wbg.__wbindgen_closure_wrapper70250 = function(arg0, arg1, arg2) {
4204
- const ret = makeMutClosure(arg0, arg1, 51473, __wbg_adapter_74);
4234
+ imports.wbg.__wbindgen_closure_wrapper70399 = function(arg0, arg1, arg2) {
4235
+ const ret = makeMutClosure(arg0, arg1, 51580, __wbg_adapter_74);
4205
4236
  return ret;
4206
4237
  };
4207
- imports.wbg.__wbindgen_closure_wrapper70252 = function(arg0, arg1, arg2) {
4208
- const ret = makeMutClosure(arg0, arg1, 51473, __wbg_adapter_74);
4238
+ imports.wbg.__wbindgen_closure_wrapper70401 = function(arg0, arg1, arg2) {
4239
+ const ret = makeMutClosure(arg0, arg1, 51580, __wbg_adapter_74);
4209
4240
  return ret;
4210
4241
  };
4211
- imports.wbg.__wbindgen_closure_wrapper70254 = function(arg0, arg1, arg2) {
4212
- const ret = makeMutClosure(arg0, arg1, 51473, __wbg_adapter_74);
4242
+ imports.wbg.__wbindgen_closure_wrapper70403 = function(arg0, arg1, arg2) {
4243
+ const ret = makeMutClosure(arg0, arg1, 51580, __wbg_adapter_74);
4213
4244
  return ret;
4214
4245
  };
4215
- imports.wbg.__wbindgen_closure_wrapper74105 = function(arg0, arg1, arg2) {
4216
- const ret = makeMutClosure(arg0, arg1, 54698, __wbg_adapter_81);
4246
+ imports.wbg.__wbindgen_closure_wrapper74254 = function(arg0, arg1, arg2) {
4247
+ const ret = makeMutClosure(arg0, arg1, 54805, __wbg_adapter_81);
4217
4248
  return ret;
4218
4249
  };
4219
- imports.wbg.__wbindgen_closure_wrapper74924 = function(arg0, arg1, arg2) {
4220
- const ret = makeMutClosure(arg0, arg1, 55015, __wbg_adapter_84);
4250
+ imports.wbg.__wbindgen_closure_wrapper75074 = function(arg0, arg1, arg2) {
4251
+ const ret = makeMutClosure(arg0, arg1, 55122, __wbg_adapter_84);
4221
4252
  return ret;
4222
4253
  };
4223
- imports.wbg.__wbindgen_closure_wrapper77165 = function(arg0, arg1, arg2) {
4224
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4254
+ imports.wbg.__wbindgen_closure_wrapper77315 = function(arg0, arg1, arg2) {
4255
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4225
4256
  return ret;
4226
4257
  };
4227
- imports.wbg.__wbindgen_closure_wrapper77167 = function(arg0, arg1, arg2) {
4228
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4258
+ imports.wbg.__wbindgen_closure_wrapper77317 = function(arg0, arg1, arg2) {
4259
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4229
4260
  return ret;
4230
4261
  };
4231
- imports.wbg.__wbindgen_closure_wrapper77169 = function(arg0, arg1, arg2) {
4232
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4262
+ imports.wbg.__wbindgen_closure_wrapper77319 = function(arg0, arg1, arg2) {
4263
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4233
4264
  return ret;
4234
4265
  };
4235
- imports.wbg.__wbindgen_closure_wrapper77171 = function(arg0, arg1, arg2) {
4236
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4266
+ imports.wbg.__wbindgen_closure_wrapper77321 = function(arg0, arg1, arg2) {
4267
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4237
4268
  return ret;
4238
4269
  };
4239
- imports.wbg.__wbindgen_closure_wrapper77173 = function(arg0, arg1, arg2) {
4240
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4270
+ imports.wbg.__wbindgen_closure_wrapper77323 = function(arg0, arg1, arg2) {
4271
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4241
4272
  return ret;
4242
4273
  };
4243
- imports.wbg.__wbindgen_closure_wrapper77175 = function(arg0, arg1, arg2) {
4244
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_98);
4274
+ imports.wbg.__wbindgen_closure_wrapper77325 = function(arg0, arg1, arg2) {
4275
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_98);
4245
4276
  return ret;
4246
4277
  };
4247
- imports.wbg.__wbindgen_closure_wrapper77177 = function(arg0, arg1, arg2) {
4248
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4278
+ imports.wbg.__wbindgen_closure_wrapper77327 = function(arg0, arg1, arg2) {
4279
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4249
4280
  return ret;
4250
4281
  };
4251
- imports.wbg.__wbindgen_closure_wrapper77179 = function(arg0, arg1, arg2) {
4252
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_87);
4282
+ imports.wbg.__wbindgen_closure_wrapper77329 = function(arg0, arg1, arg2) {
4283
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_87);
4253
4284
  return ret;
4254
4285
  };
4255
- imports.wbg.__wbindgen_closure_wrapper77181 = function(arg0, arg1, arg2) {
4256
- const ret = makeMutClosure(arg0, arg1, 56516, __wbg_adapter_105);
4286
+ imports.wbg.__wbindgen_closure_wrapper77331 = function(arg0, arg1, arg2) {
4287
+ const ret = makeMutClosure(arg0, arg1, 56623, __wbg_adapter_105);
4257
4288
  return ret;
4258
4289
  };
4259
4290
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -78,6 +78,8 @@ export const op_get_permission_types: (a: number) => any;
78
78
  export const op_set_interactable_area: (a: number, b: number, c: number, d: number, e: number) => void;
79
79
  export const op_get_mic_state: (a: number) => any;
80
80
  export const op_set_mic_enabled: (a: number, b: number) => any;
81
+ export const op_get_voice_stream: (a: number) => any;
82
+ export const op_read_voice_stream: (a: number, b: number) => any;
81
83
  export const op_testing_enabled: (a: number) => number;
82
84
  export const op_log_test_plan: (a: number, b: any) => void;
83
85
  export const op_log_test_result: (a: number, b: any) => void;
@@ -103,17 +105,17 @@ export const __wbindgen_export_7: WebAssembly.Table;
103
105
  export const __externref_drop_slice: (a: number, b: number) => void;
104
106
  export const __externref_table_dealloc: (a: number) => void;
105
107
  export const closure15250_externref_shim: (a: number, b: number, c: number, d: any) => void;
106
- export const closure47650_externref_shim: (a: number, b: number, c: any) => void;
108
+ export const closure47751_externref_shim: (a: number, b: number, c: any) => void;
107
109
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__haf6d1d6eca19ebd1: (a: number, b: number) => void;
108
110
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h88ef16e697def3fb: (a: number, b: number) => void;
109
- export const closure51472_externref_shim: (a: number, b: number, c: any) => void;
111
+ export const closure51579_externref_shim: (a: number, b: number, c: any) => void;
110
112
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9bfa50ac2770910f: (a: number, b: number) => void;
111
113
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heedd0a6395901798: (a: number, b: number) => void;
112
- export const closure56515_externref_shim: (a: number, b: number, c: any) => void;
114
+ export const closure56622_externref_shim: (a: number, b: number, c: any) => void;
113
115
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0c78161a9a71767b: (a: number, b: number) => void;
114
- export const closure56528_externref_shim: (a: number, b: number, c: any, d: any) => void;
115
- export const closure116688_externref_shim: (a: number, b: number, c: any) => void;
116
- export const closure131719_externref_shim: (a: number, b: number, c: any) => void;
117
- export const closure134623_externref_shim: (a: number, b: number, c: any, d: any) => void;
116
+ export const closure56635_externref_shim: (a: number, b: number, c: any, d: any) => void;
117
+ export const closure116795_externref_shim: (a: number, b: number, c: any) => void;
118
+ export const closure131826_externref_shim: (a: number, b: number, c: any) => void;
119
+ export const closure134730_externref_shim: (a: number, b: number, c: any, d: any) => void;
118
120
  export const __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
119
121
  export const __wbindgen_start: (a: number) => void;