@newgameplusinc/odyssey-audio-video-sdk-dev 1.0.40 → 1.0.41
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.
|
@@ -8,6 +8,7 @@ export declare class MediasoupManager {
|
|
|
8
8
|
private recvTransport;
|
|
9
9
|
private producers;
|
|
10
10
|
private consumers;
|
|
11
|
+
private participantId;
|
|
11
12
|
constructor(socket: Socket);
|
|
12
13
|
loadDevice(routerRtpCapabilities: types.RtpCapabilities): Promise<void>;
|
|
13
14
|
sendDeviceRtpCapabilities(participantId: string): void;
|
package/dist/MediasoupManager.js
CHANGED
|
@@ -41,6 +41,7 @@ class MediasoupManager {
|
|
|
41
41
|
this.recvTransport = null;
|
|
42
42
|
this.producers = new Map();
|
|
43
43
|
this.consumers = new Map();
|
|
44
|
+
this.participantId = '';
|
|
44
45
|
this.socket = socket;
|
|
45
46
|
this.device = new mediasoupClient.Device();
|
|
46
47
|
}
|
|
@@ -51,6 +52,7 @@ class MediasoupManager {
|
|
|
51
52
|
await this.device.load({ routerRtpCapabilities });
|
|
52
53
|
}
|
|
53
54
|
sendDeviceRtpCapabilities(participantId) {
|
|
55
|
+
this.participantId = participantId;
|
|
54
56
|
this.socket.emit("device-rtp-capabilities", {
|
|
55
57
|
participantId,
|
|
56
58
|
rtpCapabilities: this.device.rtpCapabilities,
|
|
@@ -102,7 +104,23 @@ class MediasoupManager {
|
|
|
102
104
|
async produce(track, appData) {
|
|
103
105
|
if (!this.sendTransport)
|
|
104
106
|
throw new Error("Send transport not initialized");
|
|
105
|
-
|
|
107
|
+
// Configure simulcast for video tracks for adaptive bitrate
|
|
108
|
+
const produceOptions = { track, appData };
|
|
109
|
+
if (track.kind === 'video') {
|
|
110
|
+
produceOptions.encodings = [
|
|
111
|
+
// Low quality layer - 100 kbps, good for poor connections
|
|
112
|
+
{ rid: 'r0', active: true, maxBitrate: 100000, scaleResolutionDownBy: 4 },
|
|
113
|
+
// Medium quality layer - 300 kbps, balanced
|
|
114
|
+
{ rid: 'r1', active: true, maxBitrate: 300000, scaleResolutionDownBy: 2 },
|
|
115
|
+
// High quality layer - 900 kbps, full resolution
|
|
116
|
+
{ rid: 'r2', active: true, maxBitrate: 900000, scaleResolutionDownBy: 1 }
|
|
117
|
+
];
|
|
118
|
+
// VP8 codec for simulcast support
|
|
119
|
+
produceOptions.codecOptions = {
|
|
120
|
+
videoGoogleStartBitrate: 1000
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const producer = await this.sendTransport.produce(produceOptions);
|
|
106
124
|
this.producers.set(producer.id, producer);
|
|
107
125
|
return producer;
|
|
108
126
|
}
|
|
@@ -120,7 +138,7 @@ class MediasoupManager {
|
|
|
120
138
|
}
|
|
121
139
|
async resumeConsumer(consumerId) {
|
|
122
140
|
return new Promise((resolve, reject) => {
|
|
123
|
-
this.socket.emit("resume-consumer", { consumerId }, (response) => {
|
|
141
|
+
this.socket.emit("resume-consumer", { consumerId, participantId: this.participantId }, (response) => {
|
|
124
142
|
if (response.error) {
|
|
125
143
|
reject(new Error(response.error));
|
|
126
144
|
}
|
package/package.json
CHANGED