Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Inform signalling server know when the frontend intends to send the o…
Browse files Browse the repository at this point in the history
…ffer (#75)
  • Loading branch information
Belchy06 committed Feb 8, 2023
1 parent 2b9badf commit 8be3b84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,11 @@ export class WebRtcPlayerController {
signallingServerUrl += '?' + Flags.PreferSFU + '=true';
}

// If we are sending the offer add a special url parameter to the url, making sure we append correctly
if (this.config.isFlagEnabled(Flags.BrowserSendOffer)) {
signallingServerUrl += (signallingServerUrl.includes('?') ? '&' : '?') + Flags.BrowserSendOffer + '=true';
}

return signallingServerUrl;
}

Expand Down
3 changes: 2 additions & 1 deletion SignallingWebServer/cirrus.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ playerServer.on('connection', function (ws, req) {
const parsedUrl = url.parse(req.url);
const urlParams = new URLSearchParams(parsedUrl.search);
const preferSFU = urlParams.has('preferSFU') && urlParams.get('preferSFU') !== 'false';
const browserSendOffer = urlParams.has('OfferToReceive') && urlParams.get('OfferToReceive') !== 'false';
const skipSFU = !preferSFU;
const skipStreamer = preferSFU && sfu;

Expand Down Expand Up @@ -628,7 +629,7 @@ playerServer.on('connection', function (ws, req) {

ws.send(JSON.stringify(clientConfig));

sendMessageToController({ type: "playerConnected", playerId: playerId, dataChannel: true, sfu: false }, skipSFU, skipStreamer);
sendMessageToController({ type: "playerConnected", playerId: playerId, dataChannel: true, sfu: false, sendOffer: !browserSendOffer }, skipSFU, skipStreamer);
sendPlayersCount();
});

Expand Down

0 comments on commit 8be3b84

Please sign in to comment.