@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.43 → 1.0.45

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.
@@ -104,6 +104,16 @@ class MediasoupManager {
104
104
  async produce(track, appData) {
105
105
  if (!this.sendTransport)
106
106
  throw new Error("Send transport not initialized");
107
+ // Check if transport is closed or failed
108
+ if (this.sendTransport.closed) {
109
+ throw new Error("Send transport is closed");
110
+ }
111
+ // Check if this track is already being produced
112
+ const existingProducer = Array.from(this.producers.values()).find(p => p.track?.id === track.id);
113
+ if (existingProducer) {
114
+ console.log(`ℹ️ [MediaSoup] Track ${track.id} already being produced, returning existing producer`);
115
+ return existingProducer;
116
+ }
107
117
  // Configure simulcast for video tracks for adaptive bitrate
108
118
  const produceOptions = { track, appData };
109
119
  if (track.kind === 'video') {
@@ -120,9 +130,16 @@ class MediasoupManager {
120
130
  videoGoogleStartBitrate: 1000
121
131
  };
122
132
  }
123
- const producer = await this.sendTransport.produce(produceOptions);
124
- this.producers.set(producer.id, producer);
125
- return producer;
133
+ try {
134
+ const producer = await this.sendTransport.produce(produceOptions);
135
+ this.producers.set(producer.id, producer);
136
+ console.log(`✅ [MediaSoup] Successfully produced ${track.kind} track`);
137
+ return producer;
138
+ }
139
+ catch (error) {
140
+ console.error(`❌ [MediaSoup] Failed to produce ${track.kind} track:`, error);
141
+ throw error;
142
+ }
126
143
  }
127
144
  async consume(data) {
128
145
  if (!this.recvTransport)
package/dist/index.js CHANGED
@@ -321,7 +321,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
321
321
  const isLocalParticipant = participant.participantId === this.localParticipant?.participantId;
322
322
  if (isLocalParticipant) {
323
323
  // Do NOT connect this audio to Web Audio API
324
- console.log(`🚫 Skipping local participant audio setup (prevent loopback)`);
325
324
  return; // Exit early to prevent any audio processing
326
325
  }
327
326
  else {
@@ -335,7 +334,7 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
335
334
  this.mediasoupManager
336
335
  .resumeConsumer(consumer.id)
337
336
  .then(() => {
338
- console.log(`✅ Consumer ${consumer.id.substring(0, 8)} resumed for ${participant?.participantId?.substring(0, 8)}`);
337
+ // Consumer resumed successfully
339
338
  })
340
339
  .catch((err) => {
341
340
  console.error(`❌ Failed to resume consumer ${consumer.id}:`, err);
@@ -450,6 +449,10 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
450
449
  }
451
450
  this.emit("participant-channel-changed", data);
452
451
  });
452
+ this.socket.on("consumer-closed", (data) => {
453
+ // Emit to app layer to handle cleanup
454
+ this.emit("consumer-closed", data);
455
+ });
453
456
  this.socket.on("mute-requested", (data) => {
454
457
  // Owner has requested this participant to mute
455
458
  this.emit("mute-requested", data);
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" | "mute-requested";
59
+ export type OdysseyEvent = "connected" | "disconnected" | "room-joined" | "all-participants-update" | "new-participant" | "participant-left" | "producer-created" | "consumer-created" | "consumer-closed" | "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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newgameplusinc/odyssey-audio-video-sdk-dev",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
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",