diff --git a/www/index.html b/www/index.html
index 6adf9f0a..63fedcec 100644
--- a/www/index.html
+++ b/www/index.html
@@ -139,7 +139,7 @@
const isChecked = checkboxStates[name] ? 'checked' : '';
tr.innerHTML =
`
| ` +
- `
${online} / info / probe | ` +
+ `
${online} / info / probe / net | ` +
`
${links} | `;
}
diff --git a/www/main.js b/www/main.js
index 2c15e071..714c9127 100644
--- a/www/main.js
+++ b/www/main.js
@@ -138,6 +138,7 @@ body.dark-mode hr {
Add
Config
Log
+
Net
🌙
diff --git a/www/network.html b/www/network.html
new file mode 100644
index 00000000..79875012
--- /dev/null
+++ b/www/network.html
@@ -0,0 +1,83 @@
+
+
+
+
+ go2rtc - Network
+
+
+
+
+
+
+
+
+
diff --git a/www/video-rtc.js b/www/video-rtc.js
index 52fb5dda..fb872b45 100644
--- a/www/video-rtc.js
+++ b/www/video-rtc.js
@@ -439,24 +439,30 @@ export class VideoRTC extends HTMLElement {
const sb = ms.addSourceBuffer(msg.value);
sb.mode = 'segments'; // segments or sequence
sb.addEventListener('updateend', () => {
- if (sb.updating) return;
-
- try {
- if (bufLen > 0) {
+ if (!sb.updating && bufLen > 0) {
+ try {
const data = buf.slice(0, bufLen);
- bufLen = 0;
sb.appendBuffer(data);
- } else if (sb.buffered && sb.buffered.length) {
- const end = sb.buffered.end(sb.buffered.length - 1) - 15;
- const start = sb.buffered.start(0);
- if (end > start) {
- sb.remove(start, end);
- ms.setLiveSeekableRange(end, end + 15);
- }
- // console.debug("VideoRTC.buffered", start, end);
+ bufLen = 0;
+ } catch (e) {
+ // console.debug(e);
}
- } catch (e) {
- // console.debug(e);
+ }
+
+ if (!sb.updating && sb.buffered && sb.buffered.length) {
+ const end = sb.buffered.end(sb.buffered.length - 1);
+ const start = end - 5;
+ const start0 = sb.buffered.start(0);
+ if (start > start0) {
+ sb.remove(start0, start);
+ ms.setLiveSeekableRange(start, end);
+ }
+ if (this.video.currentTime < start) {
+ this.video.currentTime = start;
+ }
+ const gap = end - this.video.currentTime;
+ this.video.playbackRate = gap > 0.1 ? gap : 0.1;
+ // console.debug('VideoRTC.buffered', gap, this.video.playbackRate, this.video.readyState);
}
});
@@ -468,7 +474,7 @@ export class VideoRTC extends HTMLElement {
const b = new Uint8Array(data);
buf.set(b, bufLen);
bufLen += b.byteLength;
- // console.debug("VideoRTC.buffer", b.byteLength, bufLen);
+ // console.debug('VideoRTC.buffer', b.byteLength, bufLen);
} else {
try {
sb.appendBuffer(data);