@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.37 → 1.0.38

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.
@@ -243,7 +243,11 @@ class SpatialAudioManager extends EventManager_1.EventManager {
243
243
  */
244
244
  setParticipantMuted(participantId, muted) {
245
245
  const nodes = this.participantNodes.get(participantId);
246
- if (nodes?.gain) {
246
+ if (!nodes) {
247
+ // Audio nodes don't exist yet - this is normal if called before consumer is set up
248
+ return;
249
+ }
250
+ if (nodes.gain) {
247
251
  // Set gain to 0 (muted) or 1 (unmuted) immediately
248
252
  nodes.gain.gain.setValueAtTime(muted ? 0 : 1, this.audioContext.currentTime);
249
253
  }
package/dist/index.d.ts CHANGED
@@ -95,11 +95,6 @@ export declare class OdysseySpatialComms extends EventManager {
95
95
  /**
96
96
  * Mute another participant (owner only)
97
97
  */
98
- /**
99
- * Update mute state for all participants based on channel matching
100
- * Called when local user switches channels
101
- */
102
- private updateAllParticipantsMuteState;
103
98
  muteParticipant(participantId: string): Promise<{
104
99
  success?: boolean;
105
100
  error?: string;
package/dist/index.js CHANGED
@@ -233,13 +233,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
233
233
  ? Array.from(this.room.participants.values())
234
234
  : [];
235
235
  this.emit("all-participants-update", normalizedParticipants);
236
- // CRITICAL: After receiving channel data, update ALL mute states
237
- // This ensures existing audio consumers get the correct mute state
238
- console.log(`[CHANNEL-DEBUG] all-participants-update: Received ${normalizedParticipants.length} participants`);
239
- normalizedParticipants.forEach(p => {
240
- console.log(` - ${p.participantId?.substring(0, 8)}: channel=${p.currentChannel || 'spatial'}`);
241
- });
242
- this.updateAllParticipantsMuteState();
243
236
  });
244
237
  this.socket.on("new-participant", (participantData) => {
245
238
  if (this.room) {
@@ -325,25 +318,11 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
325
318
  return; // Exit early to prevent any audio processing
326
319
  }
327
320
  else {
328
- // Check if participant is in huddle - if so, skip spatial audio
329
- const participantChannel = participant.currentChannel || "spatial";
330
- const myChannel = this.localParticipant?.currentChannel || "spatial";
331
- const isInHuddle = participantChannel !== "spatial";
332
- console.log(`[CHANNEL-DEBUG] Setting up audio consumer:`);
333
- console.log(` - Participant: ${participant.participantId?.substring(0, 8)}`);
334
- console.log(` - My channel: ${myChannel}`);
335
- console.log(` - Their channel: ${participantChannel}`);
336
- // Setup spatial audio with full 3D positioning (disabled for huddle users)
337
- await this.spatialAudioManager.setupSpatialAudioForParticipant(participant.participantId, track, isInHuddle // Disable spatial audio for huddle users
321
+ // Setup spatial audio with full 3D positioning
322
+ await this.spatialAudioManager.setupSpatialAudioForParticipant(participant.participantId, track, false // Always enable spatial audio
338
323
  );
339
- // CRITICAL: Mute if not in same channel
340
- const shouldMute = myChannel !== participantChannel;
341
- console.log(` - Should mute: ${shouldMute} (channels ${myChannel === participantChannel ? 'MATCH' : 'DIFFER'})`);
342
- this.spatialAudioManager.setParticipantMuted(participant.participantId, shouldMute);
343
- // Only update spatial audio position if NOT in huddle
344
- if (!isInHuddle) {
345
- this.spatialAudioManager.updateSpatialAudio(participant.participantId, data.position);
346
- }
324
+ // Update spatial audio position
325
+ this.spatialAudioManager.updateSpatialAudio(participant.participantId, data.position);
347
326
  }
348
327
  // NOW resume the consumer after audio pipeline is ready
349
328
  this.mediasoupManager
@@ -436,37 +415,13 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
436
415
  this.emit("huddle-ended", data);
437
416
  });
438
417
  this.socket.on("participant-channel-changed", (data) => {
439
- console.log(`📡 participant-channel-changed: ${data.participantId?.substring(0, 8)} → ${data.channelId}`);
440
418
  const participant = this.room?.participants.get(data.participantId);
441
419
  if (participant) {
442
420
  participant.currentChannel = data.channelId;
443
- // Toggle spatial audio based on channel
444
- const isInHuddle = data.channelId !== "spatial";
445
- // Update spatial audio bypass state for this participant
446
- if (participant.audioTrack) {
447
- this.spatialAudioManager.setupSpatialAudioForParticipant(participant.participantId, participant.audioTrack, isInHuddle // Disable spatial for huddle, enable for spatial
448
- ).catch(err => {
449
- console.error(`Failed to update spatial audio for ${participant.participantId}:`, err);
450
- });
451
- }
452
- // CRITICAL: Mute/unmute based on channel matching
453
- const myChannel = this.localParticipant?.currentChannel || "spatial";
454
- const theirChannel = data.channelId || "spatial";
455
- const shouldMute = myChannel !== theirChannel;
456
- console.log(`[CHANNEL-DEBUG] participant-channel-changed:`);
457
- console.log(` - Participant: ${participant.participantId?.substring(0, 8)}`);
458
- console.log(` - My channel: ${myChannel}`);
459
- console.log(` - Their new channel: ${theirChannel}`);
460
- console.log(` - Should mute: ${shouldMute}`);
461
- this.spatialAudioManager.setParticipantMuted(participant.participantId, shouldMute);
462
421
  }
463
422
  // Update local participant if it's them
464
423
  if (this.localParticipant?.participantId === data.participantId && this.localParticipant !== null) {
465
- console.log(`[CHANNEL-DEBUG] LOCAL USER changed channel to: ${data.channelId}`);
466
424
  this.localParticipant.currentChannel = data.channelId;
467
- // When LOCAL user changes channel, update ALL other participants' mute state
468
- console.log(`[CHANNEL-DEBUG] Updating ALL participants mute state...`);
469
- this.updateAllParticipantsMuteState();
470
425
  }
471
426
  this.emit("participant-channel-changed", data);
472
427
  });
@@ -541,8 +496,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
541
496
  if (response.success && this.localParticipant) {
542
497
  console.log(`✅ [joinHuddle] Success! New channel: ${response.channelId}`);
543
498
  this.localParticipant.currentChannel = response.channelId;
544
- // CRITICAL: Update mute state for all participants when joining huddle
545
- this.updateAllParticipantsMuteState();
546
499
  }
547
500
  else {
548
501
  console.error(`❌ [joinHuddle] Failed:`, response.error);
@@ -567,8 +520,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
567
520
  if (response.success && this.localParticipant) {
568
521
  console.log(`✅ [leaveHuddle] Success! New channel: ${response.channelId}`);
569
522
  this.localParticipant.currentChannel = response.channelId;
570
- // CRITICAL: Update mute state for all participants when leaving huddle
571
- this.updateAllParticipantsMuteState();
572
523
  }
573
524
  else {
574
525
  console.error(`❌ [leaveHuddle] Failed:`, response.error);
@@ -590,26 +541,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
590
541
  /**
591
542
  * Mute another participant (owner only)
592
543
  */
593
- /**
594
- * Update mute state for all participants based on channel matching
595
- * Called when local user switches channels
596
- */
597
- updateAllParticipantsMuteState() {
598
- if (!this.localParticipant || !this.room)
599
- return;
600
- const myChannel = this.localParticipant.currentChannel || "spatial";
601
- console.log(`[CHANNEL-DEBUG] updateAllParticipantsMuteState - My channel: ${myChannel}`);
602
- this.room.participants.forEach((participant) => {
603
- // Skip local participant (never hear yourself)
604
- if (participant.participantId === this.localParticipant?.participantId) {
605
- return;
606
- }
607
- const theirChannel = participant.currentChannel || "spatial";
608
- const shouldMute = myChannel !== theirChannel;
609
- console.log(` - ${participant.participantId?.substring(0, 8)}: channel=${theirChannel}, shouldMute=${shouldMute}`);
610
- this.spatialAudioManager.setParticipantMuted(participant.participantId, shouldMute);
611
- });
612
- }
613
544
  async muteParticipant(participantId) {
614
545
  if (!this.localParticipant || !this.room) {
615
546
  return { success: false, error: "Not in a room" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newgameplusinc/odyssey-audio-video-sdk-dev",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "Odyssey Spatial Audio & Video SDK using MediaSoup for real-time communication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",