Compare commits
No commits in common. "master" and "feature/serverless" have entirely different histories.
master
...
feature/se
|
@ -4,5 +4,5 @@ from . import consumers
|
||||||
|
|
||||||
websocket_urlpatterns = [
|
websocket_urlpatterns = [
|
||||||
re_path(r'camera/ws/(?P<kind>host|client)/(?P<room_name>\w+)/$',
|
re_path(r'camera/ws/(?P<kind>host|client)/(?P<room_name>\w+)/$',
|
||||||
consumers.VideoConsumer.as_asgi()),
|
consumers.VideoConsumer),
|
||||||
]
|
]
|
||||||
|
|
|
@ -373,10 +373,7 @@ form label {
|
||||||
// ... but only once icegathering is complete.
|
// ... but only once icegathering is complete.
|
||||||
pc.onnegotiationneeded = async function () {
|
pc.onnegotiationneeded = async function () {
|
||||||
log("In pc.onnegotiationneeded...");
|
log("In pc.onnegotiationneeded...");
|
||||||
const useOffer = (!settings || !('separateIce' in settings)
|
await pc.setLocalDescription(await pc.createOffer());
|
||||||
|| !settings.separateIce);
|
|
||||||
await pc.setLocalDescription(
|
|
||||||
await (useOffer ? pc.createOffer() : pc.createAnswer()));
|
|
||||||
sendOffer();
|
sendOffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +450,7 @@ form label {
|
||||||
: videoSettings == 'true'
|
: videoSettings == 'true'
|
||||||
? true
|
? true
|
||||||
: { advanced: [{facingMode: videoSettings}] };
|
: { advanced: [{facingMode: videoSettings}] };
|
||||||
log("Created videoConstraints: " + JSON.stringify(videoConstraints));
|
log("Created videoConstraints.");
|
||||||
if (!videoConstraints && !audioSettings) return;
|
if (!videoConstraints && !audioSettings) return;
|
||||||
|
|
||||||
const stream = videoSettings == 'screen'
|
const stream = videoSettings == 'screen'
|
||||||
|
@ -474,23 +471,15 @@ form label {
|
||||||
log("Added track.");
|
log("Added track.");
|
||||||
pc.addTrack(track, stream);
|
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) {
|
function startStreamingWithErorrHandling(fromButton) {
|
||||||
try {
|
startStreaming(fromButton)
|
||||||
startStreaming(fromButton)
|
.then(() => {
|
||||||
.then(() => {
|
log("startStreaming() finished.");
|
||||||
log("startStreaming() finished.");
|
})
|
||||||
})
|
.catch(e => {
|
||||||
.catch(e => {
|
log("startStreaming() errored: " + e.message);
|
||||||
log("startStreaming() errored: " + e.message);
|
});
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
log("Error in startStreaming(): " + e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start.addEventListener("click", _ => {
|
start.addEventListener("click", _ => {
|
||||||
|
@ -509,20 +498,12 @@ form label {
|
||||||
settings = data.settings;
|
settings = data.settings;
|
||||||
startStreamingWithErorrHandling(false);
|
startStreamingWithErorrHandling(false);
|
||||||
} else if (data.description) {
|
} else if (data.description) {
|
||||||
try {
|
if (pc == undefined) pc = createRTCPeerConnection();
|
||||||
if (pc == undefined) pc = createRTCPeerConnection();
|
await pc.setRemoteDescription(data.description);
|
||||||
await pc.setRemoteDescription(data.description);
|
if (data.description.type == "offer") {
|
||||||
if (data.description.type == "offer") {
|
log("Got an offer...");
|
||||||
log("Got an offer...");
|
await pc.setLocalDescription(await pc.createAnswer());
|
||||||
if (!settings || !('separateIce' in settings) || !settings.separateIce) {
|
sendOffer();
|
||||||
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