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

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.
@@ -15,7 +15,7 @@ export declare class MediasoupManager {
15
15
  createRecvTransport(participantId: string): Promise<void>;
16
16
  private connectSendTransport;
17
17
  private connectRecvTransport;
18
- produce(track: MediaStreamTrack): Promise<types.Producer>;
18
+ produce(track: MediaStreamTrack, appData?: any): Promise<types.Producer>;
19
19
  consume(data: {
20
20
  consumerId: string;
21
21
  producerId: string;
@@ -99,10 +99,10 @@ class MediasoupManager {
99
99
  });
100
100
  });
101
101
  }
102
- async produce(track) {
102
+ async produce(track, appData) {
103
103
  if (!this.sendTransport)
104
104
  throw new Error("Send transport not initialized");
105
- const producer = await this.sendTransport.produce({ track });
105
+ const producer = await this.sendTransport.produce({ track, appData });
106
106
  this.producers.set(producer.id, producer);
107
107
  return producer;
108
108
  }
package/dist/index.d.ts CHANGED
@@ -28,7 +28,9 @@ export declare class OdysseySpatialComms extends EventManager {
28
28
  leaveRoom(): void;
29
29
  resumeAudio(): Promise<void>;
30
30
  getAudioContextState(): AudioContextState;
31
- produceTrack(track: MediaStreamTrack): Promise<any>;
31
+ produceTrack(track: MediaStreamTrack, appData?: {
32
+ isScreenshare?: boolean;
33
+ }): Promise<any>;
32
34
  updatePosition(position: Position, direction: Direction, spatialData?: {
33
35
  cameraDistance?: number;
34
36
  screenPos?: {
package/dist/index.js CHANGED
@@ -101,8 +101,8 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
101
101
  getAudioContextState() {
102
102
  return this.spatialAudioManager.getAudioContextState();
103
103
  }
104
- async produceTrack(track) {
105
- const producer = await this.mediasoupManager.produce(track);
104
+ async produceTrack(track, appData) {
105
+ const producer = await this.mediasoupManager.produce(track, appData);
106
106
  if (this.localParticipant) {
107
107
  const isFirstProducer = this.localParticipant.producers.size === 0;
108
108
  this.localParticipant.producers.set(producer.id, producer);
@@ -111,8 +111,15 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
111
111
  this.localParticipant.mediaState.audio = true;
112
112
  }
113
113
  else if (track.kind === "video") {
114
- this.localParticipant.videoTrack = track;
115
- this.localParticipant.mediaState.video = true;
114
+ // Store as videoTrack or screenshareTrack based on metadata
115
+ if (appData?.isScreenshare) {
116
+ this.localParticipant.screenshareTrack = track;
117
+ this.localParticipant.mediaState.sharescreen = true;
118
+ }
119
+ else {
120
+ this.localParticipant.videoTrack = track;
121
+ this.localParticipant.mediaState.video = true;
122
+ }
116
123
  }
117
124
  // Send device RTP capabilities after first track is produced
118
125
  // This ensures transports are fully connected via DTLS
@@ -335,7 +342,16 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
335
342
  });
336
343
  }
337
344
  else if (track.kind === "video") {
338
- participant.videoTrack = track;
345
+ // Check if this is a screenshare or camera video
346
+ const isScreenshare = data.appData?.isScreenshare;
347
+ if (isScreenshare) {
348
+ // Store as screenshareTrack
349
+ participant.screenshareTrack = track;
350
+ }
351
+ else {
352
+ // Store as regular videoTrack (camera)
353
+ participant.videoTrack = track;
354
+ }
339
355
  // Resume video consumer immediately (no audio pipeline needed)
340
356
  this.mediasoupManager
341
357
  .resumeConsumer(consumer.id)
@@ -346,6 +362,7 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
346
362
  participant,
347
363
  track,
348
364
  consumer,
365
+ isScreenshare: data.appData?.isScreenshare,
349
366
  });
350
367
  }
351
368
  });
@@ -484,7 +501,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
484
501
  * Join huddle (anyone can join directly without invite)
485
502
  */
486
503
  async joinHuddle() {
487
- console.log(`🎧 [joinHuddle] Joining group huddle...`);
488
504
  if (!this.localParticipant || !this.room) {
489
505
  return { success: false, error: "Not in a room" };
490
506
  }
@@ -494,7 +510,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
494
510
  roomId: this.room.id,
495
511
  }, (response) => {
496
512
  if (response.success && this.localParticipant) {
497
- console.log(`✅ [joinHuddle] Success! New channel: ${response.channelId}`);
498
513
  this.localParticipant.currentChannel = response.channelId;
499
514
  }
500
515
  else {
@@ -508,7 +523,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
508
523
  * Leave current huddle and return to spatial audio
509
524
  */
510
525
  async leaveHuddle() {
511
- console.log(`🚪 [leaveHuddle] Leaving huddle...`);
512
526
  if (!this.localParticipant || !this.room) {
513
527
  return { success: false, error: "Not in a room" };
514
528
  }
@@ -518,7 +532,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
518
532
  roomId: this.room.id,
519
533
  }, (response) => {
520
534
  if (response.success && this.localParticipant) {
521
- console.log(`✅ [leaveHuddle] Success! New channel: ${response.channelId}`);
522
535
  this.localParticipant.currentChannel = response.channelId;
523
536
  }
524
537
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newgameplusinc/odyssey-audio-video-sdk-dev",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
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",