Compare commits
No commits in common. "bf4749499e3bd13d7d4ac2c50cd674875a2f0b79" and "131c9b3bf180c9f0bd9550c484083a7cb2473278" have entirely different histories.
bf4749499e
...
131c9b3bf1
|
@ -373,10 +373,7 @@ form label {
|
|||
// ... but only once icegathering is complete.
|
||||
pc.onnegotiationneeded = async function () {
|
||||
log("In pc.onnegotiationneeded...");
|
||||
const useOffer = (!settings || !('separateIce' in settings)
|
||||
|| !settings.separateIce);
|
||||
await pc.setLocalDescription(
|
||||
await (useOffer ? pc.createOffer() : pc.createAnswer()));
|
||||
await pc.setLocalDescription(await pc.createOffer());
|
||||
sendOffer();
|
||||
}
|
||||
|
||||
|
@ -453,7 +450,7 @@ form label {
|
|||
: videoSettings == 'true'
|
||||
? true
|
||||
: { advanced: [{facingMode: videoSettings}] };
|
||||
log("Created videoConstraints: " + JSON.stringify(videoConstraints));
|
||||
log("Created videoConstraints.");
|
||||
if (!videoConstraints && !audioSettings) return;
|
||||
|
||||
const stream = videoSettings == 'screen'
|
||||
|
@ -474,13 +471,8 @@ form label {
|
|||
log("Added track.");
|
||||
pc.addTrack(track, stream);
|
||||
}
|
||||
log('End of startStreaming(), creating answer...');
|
||||
if (settings && 'separateIce' in settings && settings.separateIce) {
|
||||
await pc.setLocalDescription(await pc.createAnswer());
|
||||
}
|
||||
}
|
||||
function startStreamingWithErorrHandling(fromButton) {
|
||||
try {
|
||||
startStreaming(fromButton)
|
||||
.then(() => {
|
||||
log("startStreaming() finished.");
|
||||
|
@ -488,9 +480,6 @@ form label {
|
|||
.catch(e => {
|
||||
log("startStreaming() errored: " + e.message);
|
||||
});
|
||||
} catch (e) {
|
||||
log("Error in startStreaming(): " + e);
|
||||
}
|
||||
}
|
||||
|
||||
start.addEventListener("click", _ => {
|
||||
|
@ -509,20 +498,12 @@ form label {
|
|||
settings = data.settings;
|
||||
startStreamingWithErorrHandling(false);
|
||||
} else if (data.description) {
|
||||
try {
|
||||
if (pc == undefined) pc = createRTCPeerConnection();
|
||||
await pc.setRemoteDescription(data.description);
|
||||
if (data.description.type == "offer") {
|
||||
log("Got an offer...");
|
||||
if (!settings || !('separateIce' in settings) || !settings.separateIce) {
|
||||
await pc.setLocalDescription(await pc.createAnswer());
|
||||
sendOffer();
|
||||
} else {
|
||||
log("separateIce mode, so delaying answer.");
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log("Error accepting remote offer/answer: " + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user