Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 78633a3

Browse files
Chunbojianjunz
authored andcommitted
Enabled Microsoft Edge JS SDK (#234)
1 parent 662f33f commit 78633a3

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/sdk/conference/channel.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,24 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
220220
this._pc.addTransceiver(stream.mediaStream.getVideoTracks()[0],
221221
transceiverInit);
222222
}
223+
} else {
224+
if (mediaOptions.audio && stream.mediaStream.getAudioTracks().length > 0) {
225+
for (const track of stream.mediaStream.getAudioTracks())
226+
this._pc.addTrack(track, stream.mediaStream);
227+
}
228+
229+
if (mediaOptions.video && stream.mediaStream.getVideoTracks().length > 0) {
230+
for (const track of stream.mediaStream.getVideoTracks())
231+
this._pc.addTrack(track, stream.mediaStream);
232+
}
223233
}
234+
224235
let localDesc;
225-
this._pc.createOffer().then((desc) => {
236+
const offerOptions = {
237+
offerToReceiveAudio: false,
238+
offerToReceiveVideo: false,
239+
};
240+
this._pc.createOffer(offerOptions).then((desc) => {
226241
if (options) {
227242
desc.sdp = this._setRtpReceiverOptions(desc.sdp, options);
228243
}
@@ -328,6 +343,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
328343
} else {
329344
mediaOptions.video = false;
330345
}
346+
331347
this._subscribedStream = stream;
332348
this._signaling.sendSignalingMessage('subscribe', {
333349
media: mediaOptions,
@@ -348,7 +364,11 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
348364
this._pc.addTransceiver('video', {direction: 'recvonly'});
349365
}
350366
}
351-
this._pc.createOffer().then((desc) => {
367+
const offerOptions = {
368+
offerToReceiveAudio: !!options.audio,
369+
offerToReceiveVideo: !!options.video,
370+
};
371+
this._pc.createOffer(offerOptions).then((desc) => {
352372
if (options) {
353373
desc.sdp = this._setRtpReceiverOptions(desc.sdp, options);
354374
}

0 commit comments

Comments
 (0)