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