|
|
@@ -86,7 +86,7 @@
|
|
|
<script>
|
|
|
(function () {
|
|
|
var canvas = document.getElementById("frame");
|
|
|
- var ctx = canvas.getContext("2d");
|
|
|
+ var ctx = canvas.getContext("2d", { alpha: false, desynchronized: true });
|
|
|
var btnConn = document.getElementById("btn-connect");
|
|
|
var statusEl = document.getElementById("status");
|
|
|
var statusTxt = document.getElementById("status-text");
|
|
|
@@ -119,7 +119,7 @@
|
|
|
var data = pendingData;
|
|
|
pendingData = null;
|
|
|
decoding = true;
|
|
|
- createImageBitmap(new Blob([data], { type: "image/jpeg" })).then(function (bmp) {
|
|
|
+ createImageBitmap(data).then(function (bmp) {
|
|
|
if (canvas.width !== bmp.width || canvas.height !== bmp.height) {
|
|
|
canvas.width = bmp.width;
|
|
|
canvas.height = bmp.height;
|
|
|
@@ -138,7 +138,7 @@
|
|
|
if (ws) disconnect();
|
|
|
|
|
|
ws = new WebSocket(wsUrlFromLocation());
|
|
|
- ws.binaryType = "arraybuffer";
|
|
|
+ ws.binaryType = "blob";
|
|
|
|
|
|
ws.onopen = function () {
|
|
|
statusEl.className = "live";
|
|
|
@@ -147,6 +147,8 @@
|
|
|
btnConn.className = "disconnect";
|
|
|
fpsTimer = setInterval(function () {
|
|
|
statFps.textContent = fpsCounter;
|
|
|
+ statFrames.textContent = totalFrames;
|
|
|
+ statBytes.textContent = formatBytes(totalBytes);
|
|
|
fpsCounter = 0;
|
|
|
}, 1000);
|
|
|
};
|
|
|
@@ -157,9 +159,7 @@
|
|
|
|
|
|
totalFrames++;
|
|
|
fpsCounter++;
|
|
|
- totalBytes += ev.data.byteLength;
|
|
|
- statFrames.textContent = totalFrames;
|
|
|
- statBytes.textContent = formatBytes(totalBytes);
|
|
|
+ totalBytes += ev.data.size;
|
|
|
};
|
|
|
|
|
|
ws.onclose = function () { setDisconnected(); };
|