浏览代码

Catch more errors and output them to the log.

master
父节点
当前提交
f025675b9b
共有 1 个文件被更改,包括 24 次插入16 次删除
  1. +24
    -16
      camera/templates/index.html

+ 24
- 16
camera/templates/index.html 查看文件

@@ -480,13 +480,17 @@ form label {
}
}
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", _ => {
@@ -505,16 +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...");
if (!settings || !('separateIce' in settings) || !settings.separateIce) {
await pc.setLocalDescription(await pc.createAnswer());
sendOffer();
} else {
log("separateIce mode, so delaying answer.");
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);
}
}
};


正在加载...
取消
保存