@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.30 → 1.0.32
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 +7 -0
- package/dist/index.js +46 -6
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,13 @@ export declare class OdysseySpatialComms extends EventManager {
|
|
|
92
92
|
* Get participant's current channel
|
|
93
93
|
*/
|
|
94
94
|
getParticipantChannel(participantId: string): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Mute another participant (owner only)
|
|
97
|
+
*/
|
|
98
|
+
muteParticipant(participantId: string): Promise<{
|
|
99
|
+
success?: boolean;
|
|
100
|
+
error?: string;
|
|
101
|
+
}>;
|
|
95
102
|
/**
|
|
96
103
|
* Get local participant's current channel
|
|
97
104
|
*/
|
package/dist/index.js
CHANGED
|
@@ -314,11 +314,16 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
314
314
|
return; // Exit early to prevent any audio processing
|
|
315
315
|
}
|
|
316
316
|
else {
|
|
317
|
-
//
|
|
318
|
-
|
|
317
|
+
// Check if participant is in huddle - if so, skip spatial audio
|
|
318
|
+
const participantChannel = participant.currentChannel;
|
|
319
|
+
const isInHuddle = participantChannel === "odyssey-huddle";
|
|
320
|
+
// Setup spatial audio with full 3D positioning (disabled for huddle users)
|
|
321
|
+
await this.spatialAudioManager.setupSpatialAudioForParticipant(participant.participantId, track, isInHuddle // Disable spatial audio for huddle users
|
|
319
322
|
);
|
|
320
|
-
//
|
|
321
|
-
|
|
323
|
+
// Only update spatial audio position if NOT in huddle
|
|
324
|
+
if (!isInHuddle) {
|
|
325
|
+
this.spatialAudioManager.updateSpatialAudio(participant.participantId, data.position);
|
|
326
|
+
}
|
|
322
327
|
}
|
|
323
328
|
}
|
|
324
329
|
else if (track.kind === "video") {
|
|
@@ -346,8 +351,13 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
346
351
|
participant.userName = data.userName;
|
|
347
352
|
if (data.userEmail !== undefined)
|
|
348
353
|
participant.userEmail = data.userEmail;
|
|
349
|
-
//
|
|
350
|
-
|
|
354
|
+
// Only update spatial audio if NOT in huddle
|
|
355
|
+
const participantChannel = participant.currentChannel;
|
|
356
|
+
const isInHuddle = participantChannel === "odyssey-huddle";
|
|
357
|
+
if (!isInHuddle) {
|
|
358
|
+
// Update spatial audio with BOTH position AND direction from socket
|
|
359
|
+
this.spatialAudioManager.updateSpatialAudio(data.participantId, data.position, data.direction);
|
|
360
|
+
}
|
|
351
361
|
this.emit("participant-position-updated", participant);
|
|
352
362
|
}
|
|
353
363
|
});
|
|
@@ -395,6 +405,15 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
395
405
|
const participant = this.room?.participants.get(data.participantId);
|
|
396
406
|
if (participant) {
|
|
397
407
|
participant.currentChannel = data.channelId;
|
|
408
|
+
// Toggle spatial audio based on channel
|
|
409
|
+
const isInHuddle = data.channelId === "odyssey-huddle";
|
|
410
|
+
// Update spatial audio bypass state for this participant
|
|
411
|
+
if (participant.audioTrack) {
|
|
412
|
+
this.spatialAudioManager.setupSpatialAudioForParticipant(participant.participantId, participant.audioTrack, isInHuddle // Disable spatial for huddle, enable for spatial
|
|
413
|
+
).catch(err => {
|
|
414
|
+
console.error(`Failed to update spatial audio for ${participant.participantId}:`, err);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
398
417
|
}
|
|
399
418
|
// Update local participant if it's them
|
|
400
419
|
if (this.localParticipant?.participantId === data.participantId && this.localParticipant !== null) {
|
|
@@ -402,6 +421,10 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
402
421
|
}
|
|
403
422
|
this.emit("participant-channel-changed", data);
|
|
404
423
|
});
|
|
424
|
+
this.socket.on("mute-requested", (data) => {
|
|
425
|
+
// Owner has requested this participant to mute
|
|
426
|
+
this.emit("mute-requested", data);
|
|
427
|
+
});
|
|
405
428
|
}
|
|
406
429
|
// ==================== HUDDLE METHODS ====================
|
|
407
430
|
/**
|
|
@@ -501,6 +524,23 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
501
524
|
});
|
|
502
525
|
});
|
|
503
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* Mute another participant (owner only)
|
|
529
|
+
*/
|
|
530
|
+
async muteParticipant(participantId) {
|
|
531
|
+
if (!this.localParticipant || !this.room) {
|
|
532
|
+
return { success: false, error: "Not in a room" };
|
|
533
|
+
}
|
|
534
|
+
return new Promise((resolve) => {
|
|
535
|
+
this.socket.emit("mute-participant", {
|
|
536
|
+
targetParticipantId: participantId,
|
|
537
|
+
roomId: this.room.id,
|
|
538
|
+
requesterId: this.localParticipant.participantId,
|
|
539
|
+
}, (response) => {
|
|
540
|
+
resolve(response);
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
}
|
|
504
544
|
/**
|
|
505
545
|
* Get local participant's current channel
|
|
506
546
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -56,4 +56,4 @@ export interface ParticipantsSnapshotEvent {
|
|
|
56
56
|
}>;
|
|
57
57
|
timestamp: number;
|
|
58
58
|
}
|
|
59
|
-
export type OdysseyEvent = "connected" | "disconnected" | "room-joined" | "all-participants-update" | "new-participant" | "participant-left" | "producer-created" | "consumer-created" | "participant-media-state-updated" | "participant-position-updated" | "error" | "huddle-invite-received" | "private-huddle-started" | "huddle-updated" | "huddle-invite-rejected" | "huddle-ended" | "participant-channel-changed";
|
|
59
|
+
export type OdysseyEvent = "connected" | "disconnected" | "room-joined" | "all-participants-update" | "new-participant" | "participant-left" | "producer-created" | "consumer-created" | "participant-media-state-updated" | "participant-position-updated" | "error" | "huddle-invite-received" | "private-huddle-started" | "huddle-updated" | "huddle-invite-rejected" | "huddle-ended" | "participant-channel-changed" | "mute-requested";
|
package/package.json
CHANGED