Spiele Filme in allen Playern über die gespeicherte Qualitätsleiter.
Deploy Test / test (push) Successful in 25s
Deploy Test / deploy (push) Successful in 27s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 21:48:33 +01:00
1 parent 8e77defaca
commit 1fb48783bf
14 files changed
+202 -18

No files matched your search

+30 -2
View File
@@ -1,12 +1,18 @@
import Hls from 'hls.js';
document.querySelectorAll('video[data-hls]').forEach((video) => {
function attachPlayback(video) {
if (!(video instanceof HTMLVideoElement) || video.dataset.playbackReady === '1') {
return;
}
const source = video.dataset.hls;
if (!source) {
return;
}
video.dataset.playbackReady = '1';
if (Hls.isSupported()) {
const playback = new Hls();
playback.loadSource(source);
@@ -18,7 +24,29 @@ document.querySelectorAll('video[data-hls]').forEach((video) => {
if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = source;
}
});
}
function scanPlayback(root) {
if (root instanceof HTMLVideoElement) {
attachPlayback(root);
}
if (root instanceof Element) {
root.querySelectorAll('video[data-hls]').forEach(attachPlayback);
}
}
scanPlayback(document);
new MutationObserver((records) => {
records.forEach((record) => {
record.addedNodes.forEach((node) => {
if (node instanceof Element) {
scanPlayback(node);
}
});
});
}).observe(document.documentElement, { childList: true, subtree: true });
document.addEventListener('click', (event) => {
const fullscreen = event.target.closest('[data-fullscreen]');