@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.58 → 1.0.59
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/index.d.ts +8 -0
- package/dist/index.js +30 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export declare class OdysseySpatialComms extends EventManager {
|
|
|
13
13
|
constructor(serverUrl: string, spatialOptions?: SpatialAudioOptions);
|
|
14
14
|
on(event: OdysseyEvent, listener: (...args: any[]) => void): this;
|
|
15
15
|
emit(event: OdysseyEvent, ...args: any[]): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Initialize ML-based noise suppression
|
|
18
|
+
* Note: This SDK uses AudioWorklet-based denoising configured via SpatialAudioOptions.
|
|
19
|
+
* This method is provided for API compatibility but the actual noise reduction
|
|
20
|
+
* is handled by the SpatialAudioManager's denoiser configuration.
|
|
21
|
+
* @param modelPath Path to the ML model (currently not used)
|
|
22
|
+
*/
|
|
23
|
+
initializeMLNoiseSuppression(modelPath: string): Promise<void>;
|
|
16
24
|
joinRoom(data: {
|
|
17
25
|
roomId: string;
|
|
18
26
|
userId: string;
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,20 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
30
30
|
// Explicitly call EventEmitter's emit method
|
|
31
31
|
return super.emit(event, ...args);
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Initialize ML-based noise suppression
|
|
35
|
+
* Note: This SDK uses AudioWorklet-based denoising configured via SpatialAudioOptions.
|
|
36
|
+
* This method is provided for API compatibility but the actual noise reduction
|
|
37
|
+
* is handled by the SpatialAudioManager's denoiser configuration.
|
|
38
|
+
* @param modelPath Path to the ML model (currently not used)
|
|
39
|
+
*/
|
|
40
|
+
async initializeMLNoiseSuppression(modelPath) {
|
|
41
|
+
console.log(`[OdysseySpatialComms] ML Noise Suppression initialization called with model: ${modelPath}`);
|
|
42
|
+
console.log("[OdysseySpatialComms] Note: Noise reduction is handled by AudioWorklet denoiser in SpatialAudioManager");
|
|
43
|
+
// This is a stub method for API compatibility
|
|
44
|
+
// The actual noise suppression is handled by the SpatialAudioManager's denoiser
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
}
|
|
33
47
|
async joinRoom(data) {
|
|
34
48
|
return new Promise((resolve, reject) => {
|
|
35
49
|
// Create a one-time listener for room-joined event
|
|
@@ -142,17 +156,22 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
142
156
|
this.localParticipant.producers.clear();
|
|
143
157
|
const tracksToReproduce = [];
|
|
144
158
|
// Collect audio track
|
|
145
|
-
if (this.localParticipant.audioTrack &&
|
|
159
|
+
if (this.localParticipant.audioTrack &&
|
|
160
|
+
this.localParticipant.audioTrack.readyState === "live") {
|
|
146
161
|
tracksToReproduce.push({ track: this.localParticipant.audioTrack });
|
|
147
162
|
}
|
|
148
163
|
// Collect video track
|
|
149
|
-
if (this.localParticipant.videoTrack &&
|
|
164
|
+
if (this.localParticipant.videoTrack &&
|
|
165
|
+
this.localParticipant.videoTrack.readyState === "live") {
|
|
150
166
|
tracksToReproduce.push({ track: this.localParticipant.videoTrack });
|
|
151
167
|
}
|
|
152
168
|
// Collect screenshare track
|
|
153
169
|
const screenshareTrack = this.localParticipant.screenshareTrack;
|
|
154
|
-
if (screenshareTrack && screenshareTrack.readyState ===
|
|
155
|
-
tracksToReproduce.push({
|
|
170
|
+
if (screenshareTrack && screenshareTrack.readyState === "live") {
|
|
171
|
+
tracksToReproduce.push({
|
|
172
|
+
track: screenshareTrack,
|
|
173
|
+
appData: { isScreenshare: true },
|
|
174
|
+
});
|
|
156
175
|
}
|
|
157
176
|
// Recreate producers
|
|
158
177
|
for (const { track, appData } of tracksToReproduce) {
|
|
@@ -232,8 +251,7 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
232
251
|
participantId: snapshot.participantId,
|
|
233
252
|
userId: snapshot.userId,
|
|
234
253
|
deviceId: snapshot.deviceId,
|
|
235
|
-
isLocal: this.localParticipant?.participantId ===
|
|
236
|
-
snapshot.participantId,
|
|
254
|
+
isLocal: this.localParticipant?.participantId === snapshot.participantId,
|
|
237
255
|
audioTrack: undefined,
|
|
238
256
|
videoTrack: undefined,
|
|
239
257
|
producers: new Map(),
|
|
@@ -257,7 +275,8 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
257
275
|
participant.isLocal =
|
|
258
276
|
this.localParticipant?.participantId === snapshot.participantId;
|
|
259
277
|
// CRITICAL: Store channel data for huddle detection
|
|
260
|
-
participant.currentChannel =
|
|
278
|
+
participant.currentChannel =
|
|
279
|
+
snapshot.currentChannel || "spatial";
|
|
261
280
|
this.room?.participants.set(snapshot.participantId, participant);
|
|
262
281
|
if (participant.isLocal) {
|
|
263
282
|
this.localParticipant = participant;
|
|
@@ -352,7 +371,8 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
352
371
|
participant.audioTrack = track;
|
|
353
372
|
// CRITICAL: Do NOT setup spatial audio for local participant (yourself)
|
|
354
373
|
// This prevents hearing your own microphone (loopback)
|
|
355
|
-
const isLocalParticipant = participant.participantId ===
|
|
374
|
+
const isLocalParticipant = participant.participantId ===
|
|
375
|
+
this.localParticipant?.participantId;
|
|
356
376
|
if (isLocalParticipant) {
|
|
357
377
|
// Do NOT connect this audio to Web Audio API
|
|
358
378
|
return; // Exit early to prevent any audio processing
|
|
@@ -480,7 +500,8 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
480
500
|
}
|
|
481
501
|
}
|
|
482
502
|
// Update local participant if it's them
|
|
483
|
-
if (this.localParticipant?.participantId === data.participantId &&
|
|
503
|
+
if (this.localParticipant?.participantId === data.participantId &&
|
|
504
|
+
this.localParticipant !== null) {
|
|
484
505
|
this.localParticipant.currentChannel = data.channelId;
|
|
485
506
|
}
|
|
486
507
|
this.emit("participant-channel-changed", data);
|
package/package.json
CHANGED