@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.38 → 1.0.40
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/MediasoupManager.d.ts +1 -1
- package/dist/MediasoupManager.js +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +29 -9
- package/package.json +1 -1
|
@@ -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;
|
package/dist/MediasoupManager.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
115
|
-
|
|
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
|
-
|
|
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
|
});
|
|
@@ -418,6 +435,13 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
418
435
|
const participant = this.room?.participants.get(data.participantId);
|
|
419
436
|
if (participant) {
|
|
420
437
|
participant.currentChannel = data.channelId;
|
|
438
|
+
// If this participant is now in a different channel from us, clear their screenshare
|
|
439
|
+
const myChannel = this.localParticipant?.currentChannel || "spatial";
|
|
440
|
+
const theirChannel = data.channelId || "spatial";
|
|
441
|
+
if (myChannel !== theirChannel) {
|
|
442
|
+
// Clear screenshare track when they switch to different channel
|
|
443
|
+
participant.screenshareTrack = null;
|
|
444
|
+
}
|
|
421
445
|
}
|
|
422
446
|
// Update local participant if it's them
|
|
423
447
|
if (this.localParticipant?.participantId === data.participantId && this.localParticipant !== null) {
|
|
@@ -484,7 +508,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
484
508
|
* Join huddle (anyone can join directly without invite)
|
|
485
509
|
*/
|
|
486
510
|
async joinHuddle() {
|
|
487
|
-
console.log(`🎧 [joinHuddle] Joining group huddle...`);
|
|
488
511
|
if (!this.localParticipant || !this.room) {
|
|
489
512
|
return { success: false, error: "Not in a room" };
|
|
490
513
|
}
|
|
@@ -494,7 +517,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
494
517
|
roomId: this.room.id,
|
|
495
518
|
}, (response) => {
|
|
496
519
|
if (response.success && this.localParticipant) {
|
|
497
|
-
console.log(`✅ [joinHuddle] Success! New channel: ${response.channelId}`);
|
|
498
520
|
this.localParticipant.currentChannel = response.channelId;
|
|
499
521
|
}
|
|
500
522
|
else {
|
|
@@ -508,7 +530,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
508
530
|
* Leave current huddle and return to spatial audio
|
|
509
531
|
*/
|
|
510
532
|
async leaveHuddle() {
|
|
511
|
-
console.log(`🚪 [leaveHuddle] Leaving huddle...`);
|
|
512
533
|
if (!this.localParticipant || !this.room) {
|
|
513
534
|
return { success: false, error: "Not in a room" };
|
|
514
535
|
}
|
|
@@ -518,7 +539,6 @@ class OdysseySpatialComms extends EventManager_1.EventManager {
|
|
|
518
539
|
roomId: this.room.id,
|
|
519
540
|
}, (response) => {
|
|
520
541
|
if (response.success && this.localParticipant) {
|
|
521
|
-
console.log(`✅ [leaveHuddle] Success! New channel: ${response.channelId}`);
|
|
522
542
|
this.localParticipant.currentChannel = response.channelId;
|
|
523
543
|
}
|
|
524
544
|
else {
|
package/package.json
CHANGED