@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.260 → 1.0.262

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.
@@ -66,38 +66,74 @@ class MediasoupManager {
66
66
  }
67
67
  async createSendTransport(participantId) {
68
68
  const params = await this.createWebRtcTransport('send', participantId);
69
- this.sendTransport = this.device.createSendTransport(params);
69
+ // Extract iceServers from params and pass them correctly
70
+ const { iceServers, ...transportParams } = params;
71
+ console.log(`🎧 [MediasoupManager] Creating send transport with ICE servers:`, {
72
+ hasIceServers: !!iceServers,
73
+ iceServerCount: iceServers?.length || 0,
74
+ });
75
+ this.sendTransport = this.device.createSendTransport({
76
+ ...transportParams,
77
+ iceServers: iceServers || [],
78
+ });
70
79
  this.connectSendTransport();
71
80
  }
72
81
  async createRecvTransport(participantId) {
73
82
  const params = await this.createWebRtcTransport('recv', participantId);
74
- this.recvTransport = this.device.createRecvTransport(params);
83
+ // Extract iceServers from params and pass them correctly
84
+ const { iceServers, ...transportParams } = params;
85
+ console.log(`🎧 [MediasoupManager] Creating recv transport with ICE servers:`, {
86
+ hasIceServers: !!iceServers,
87
+ iceServerCount: iceServers?.length || 0,
88
+ iceServers: iceServers,
89
+ });
90
+ this.recvTransport = this.device.createRecvTransport({
91
+ ...transportParams,
92
+ iceServers: iceServers || [],
93
+ });
75
94
  this.connectRecvTransport();
76
95
  }
77
96
  connectSendTransport() {
78
97
  this.sendTransport?.on('connect', async ({ dtlsParameters }, callback, errback) => {
98
+ console.log(`🎤 [MediasoupManager] Send transport connecting, DTLS params:`, {
99
+ transportId: this.sendTransport.id.substring(0, 8),
100
+ });
79
101
  this.socket.emit('connect-transport', { transportId: this.sendTransport.id, dtlsParameters }, (response) => {
80
- if (response.error)
102
+ if (response.error) {
103
+ console.error(`🎤 [MediasoupManager] ❌ Send transport connect failed:`, response.error);
81
104
  errback(new Error(response.error));
82
- else
105
+ }
106
+ else {
107
+ console.log(`🎤 [MediasoupManager] ✅ Send transport connected`);
83
108
  callback();
109
+ }
84
110
  });
85
111
  });
86
112
  this.sendTransport?.on('produce', async ({ kind, rtpParameters, appData, }, callback, errback) => {
113
+ console.log(`🎤 [MediasoupManager] Producing ${kind} track via socket...`);
87
114
  this.socket.emit('produce', {
88
115
  transportId: this.sendTransport.id,
89
116
  kind,
90
117
  rtpParameters,
91
118
  appData,
92
119
  }, (response) => {
93
- if (response.error)
120
+ if (response.error) {
121
+ console.error(`🎤 [MediasoupManager] ❌ Produce failed:`, response.error);
94
122
  errback(new Error(response.error));
95
- else if (response.producerId)
123
+ }
124
+ else if (response.producerId) {
125
+ console.log(`🎤 [MediasoupManager] ✅ Produce success, producerId:`, response.producerId.substring(0, 8));
96
126
  callback({ id: response.producerId });
127
+ }
97
128
  });
98
129
  });
99
130
  this.sendTransport?.on('connectionstatechange', (state) => {
131
+ console.log(`🎤 [MediasoupManager] Send transport connection state changed: ${state}`);
132
+ if (state === 'connected') {
133
+ console.log(`🎤 [MediasoupManager] ✅ Send transport fully connected!`);
134
+ }
100
135
  if (state === 'failed' || state === 'closed') {
136
+ console.error(`🎤 [MediasoupManager] ❌ Send transport ${state}`);
101
137
  this.producers.clear();
102
138
  this.socket.emit('transport-failed', {
103
139
  participantId: this.participantId,
@@ -105,6 +141,10 @@ class MediasoupManager {
105
141
  });
106
142
  }
107
143
  });
144
+ // Also monitor ICE state separately
145
+ this.sendTransport?.on('icegatheringstatechange', (state) => {
146
+ console.log(`🎤 [MediasoupManager] Send transport ICE gathering state: ${state}`);
147
+ });
108
148
  }
109
149
  connectRecvTransport() {
110
150
  this.recvTransport?.on('connect', async ({ dtlsParameters }, callback, errback) => {
@@ -127,11 +167,27 @@ class MediasoupManager {
127
167
  if (state === 'failed' || state === 'closed') {
128
168
  console.error(`🎧 [MediasoupManager] ❌ Recv transport ${state}`);
129
169
  }
170
+ if (state === 'connected') {
171
+ console.log(`🎧 [MediasoupManager] ✅ Recv transport fully connected!`);
172
+ }
173
+ });
174
+ // Also monitor ICE state separately
175
+ this.recvTransport?.on('icegatheringstatechange', (state) => {
176
+ console.log(`🎧 [MediasoupManager] Recv transport ICE gathering state: ${state}`);
130
177
  });
131
178
  }
132
179
  async produce(track, appData) {
133
180
  if (!this.sendTransport)
134
181
  throw new Error('Send transport not initialized');
182
+ // Debug: Log track state BEFORE producing
183
+ console.log(`🎤 [MediasoupManager] Producing ${track.kind} track:`, {
184
+ trackId: track.id.substring(0, 8),
185
+ enabled: track.enabled,
186
+ muted: track.muted,
187
+ readyState: track.readyState,
188
+ label: track.label,
189
+ sendTransportState: this.sendTransport.connectionState,
190
+ });
135
191
  const produceOptions = { track, appData };
136
192
  if (track.kind === 'video') {
137
193
  produceOptions.encodings = [
@@ -144,6 +200,12 @@ class MediasoupManager {
144
200
  };
145
201
  }
146
202
  const producer = await this.sendTransport.produce(produceOptions);
203
+ console.log(`🎤 [MediasoupManager] Producer created:`, {
204
+ producerId: producer.id.substring(0, 8),
205
+ kind: producer.kind,
206
+ paused: producer.paused,
207
+ closed: producer.closed,
208
+ });
147
209
  producer.on('transportclose', () => {
148
210
  this.producers.delete(producer.id);
149
211
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newgameplusinc/odyssey-audio-video-sdk-dev",
3
- "version": "1.0.260",
3
+ "version": "1.0.262",
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",