From 4d39aada70fbcbe2c079f2328bbad4450cbdc3fe Mon Sep 17 00:00:00 2001 From: miri Date: Mon, 8 Jul 2024 20:17:59 +0200 Subject: [PATCH 1/9] added loea specific css --- assets/css/default.css | 25 +++++++++++++------------ assets/css/player.css | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index a47762ec..0d2e3e2a 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -121,6 +121,7 @@ body a.channel-owner { display: flex; justify-content: center; flex-wrap: wrap; + margin-bottom: 8px; } .feed-menu-item { @@ -213,7 +214,7 @@ div.watched-overlay { left: 0; right: 0; bottom: 0; - background-color: rgba(255,255,255,.4); + background-color: rgba(255,255,255, 0); } div.watched-indicator { @@ -238,7 +239,7 @@ div.thumbnail > .bottom-right-overlay { .bottom-right-overlay { bottom: 0.6em; right: 0.6em; } .length { - padding: 1px; + padding: 2px; margin: -2px 0; color: #fff; border-radius: 3px; @@ -454,7 +455,7 @@ footer { } .dark-theme footer { - color: #adadad; + color: #75c8d9; } .light-theme footer a { @@ -615,15 +616,15 @@ span > select { body.dark-theme { background-color: rgba(35, 35, 35, 1); - color: #f0f0f0; + color: #c0ffee; } .dark-theme .pure-form legend { - color: #f0f0f0; + color: #c0ffee; } .dark-theme .pure-menu-heading { - color: #f0f0f0; + color: #c0ffee; } .dark-theme input, @@ -633,7 +634,7 @@ body.dark-theme { } .dark-theme .pure-form input[type="file"] { - color: #f0f0f0; + color: #c0ffee; } .dark-theme .searchbar input { @@ -668,16 +669,16 @@ body.dark-theme { } body.no-theme { - background-color: rgba(35, 35, 35, 1); - color: #f0f0f0; + background-color: rgba(0, 0, 0, 1); + color: #daffff; } .no-theme .pure-form legend { - color: #f0f0f0; + color: #c0ffee; } .no-theme .pure-menu-heading { - color: #f0f0f0; + color: #c0ffee; } .no-theme input, @@ -687,7 +688,7 @@ body.dark-theme { } .no-theme .pure-form input[type="file"] { - color: #f0f0f0; + color: #c0ffee; } .no-theme .searchbar input { diff --git a/assets/css/player.css b/assets/css/player.css index 50c7a748..b2fb8ebf 100644 --- a/assets/css/player.css +++ b/assets/css/player.css @@ -234,6 +234,8 @@ video.video-js { margin-right: 1em; padding-bottom: 82vh; height: 0; + border-radius: 5px; + overflow: hidden; } .mobile-operations-bar { From 992a4b206646743e41bcc0cc8f392546229f7342 Mon Sep 17 00:00:00 2001 From: miri Date: Fri, 13 Sep 2024 16:54:28 +0200 Subject: [PATCH 2/9] added direct dash to play videos with higher quality without proxy --- assets/js/itags.js | 827 ++++++++++++++++++++++++++++++++++ assets/js/player.js | 61 +++ src/invidious/views/watch.ecr | 1 + 3 files changed, 889 insertions(+) create mode 100644 assets/js/itags.js diff --git a/assets/js/itags.js b/assets/js/itags.js new file mode 100644 index 00000000..c7f3b5d1 --- /dev/null +++ b/assets/js/itags.js @@ -0,0 +1,827 @@ +// data from https://github.com/leonbrandt/yt-itag + +let itag_formats = + +[ +{ + "audioBitrate": 96, + "audioCodec": "AAC", + "audioQuality": "AUDIO_QUALITY_LOW", + "audioSampleRate": 44100, + "container": "mp4", + "hasAudio": true, + "hasVideo": true, + "itag": 18, + "quality": "medium", + "qualityLabel": "360p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 192, + "audioCodec": "AAC", + "audioQuality": "AUDIO_QUALITY_MEDIUM", + "audioSampleRate": 44100, + "container": "mp4", + "hasAudio": true, + "hasVideo": true, + "itag": 22, + "quality": "hd720", + "qualityLabel": "720p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 48, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "ts", + "hasAudio": true, + "hasVideo": true, + "itag": 91, + "quality": null, + "qualityLabel": "144p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 48, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "ts", + "hasAudio": true, + "hasVideo": true, + "itag": 92, + "quality": null, + "qualityLabel": "240p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 128, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "ts", + "hasAudio": true, + "hasVideo": true, + "itag": 93, + "quality": null, + "qualityLabel": "360p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 128, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "ts", + "hasAudio": true, + "hasVideo": true, + "itag": 94, + "quality": null, + "qualityLabel": "480p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 256, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "ts", + "hasAudio": true, + "hasVideo": true, + "itag": 95, + "quality": null, + "qualityLabel": "720p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 256, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "ts", + "hasAudio": true, + "hasVideo": true, + "itag": 96, + "quality": null, + "qualityLabel": "1080p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 133, + "quality": "small", + "qualityLabel": "240p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 134, + "quality": "medium", + "qualityLabel": "360p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 135, + "quality": "large", + "qualityLabel": "480p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 136, + "quality": "hd720", + "qualityLabel": "720p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 137, + "quality": "hd1080", + "qualityLabel": "1080p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 138, + "quality": "highres", + "qualityLabel": "4320p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": 48, + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": true, + "hasVideo": false, + "itag": 139, + "quality": null, + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": 128, + "audioCodec": "AAC", + "audioQuality": "AUDIO_QUALITY_MEDIUM", + "audioSampleRate": "44100", + "container": "mp4", + "hasAudio": true, + "hasVideo": false, + "itag": 140, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 160, + "quality": "tiny", + "qualityLabel": "144p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 242, + "quality": "small", + "qualityLabel": "240p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 243, + "quality": "medium", + "qualityLabel": "360p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 244, + "quality": "large", + "qualityLabel": "480p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 247, + "quality": "hd720", + "qualityLabel": "720p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 248, + "quality": "hd1080", + "qualityLabel": "1080p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": "48", + "audioCodec": "OPUS", + "audioQuality": "AUDIO_QUALITY_LOW", + "audioSampleRate": "48000", + "container": "webm", + "hasAudio": true, + "hasVideo": false, + "itag": 249, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": "64", + "audioCodec": "OPUS", + "audioQuality": "AUDIO_QUALITY_LOW", + "audioSampleRate": "48000", + "container": "webm", + "hasAudio": true, + "hasVideo": false, + "itag": 250, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": "160", + "audioCodec": "OPUS", + "audioQuality": "AUDIO_QUALITY_MEDIUM", + "audioSampleRate": "48000", + "container": "webm", + "hasAudio": true, + "hasVideo": false, + "itag": 251, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 264, + "quality": "hd1440", + "qualityLabel": "1440p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 266, + "quality": "hd2160", + "qualityLabel": "2160p", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 271, + "quality": "hd1440", + "qualityLabel": "1440p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 272, + "quality": "highres", + "qualityLabel": "4320p60", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 278, + "quality": "tiny", + "qualityLabel": "144p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 298, + "quality": "hd720", + "qualityLabel": "720p60", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 299, + "quality": "hd1080", + "qualityLabel": "1080p60", + "videoCodec": "AVC" +}, +{ + "audioBitrate": "128", + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": "48000", + "container": "mp4", + "hasAudio": true, + "hasVideo": true, + "itag": 300, + "quality": null, + "qualityLabel": "720p60", + "videoCodec": "AVC" +}, +{ + "audioBitrate": "128", + "audioCodec": "AAC", + "audioQuality": null, + "audioSampleRate": "48000", + "container": "mp4", + "hasAudio": true, + "hasVideo": true, + "itag": 301, + "quality": null, + "qualityLabel": "1080p60", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 302, + "quality": "hd720", + "qualityLabel": "720p60", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 303, + "quality": "hd1080", + "qualityLabel": "1080p60", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 304, + "quality": "hd1440", + "qualityLabel": "1440p60", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 305, + "quality": "hd2160", + "qualityLabel": "2160p60", + "videoCodec": "AVC" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 308, + "quality": "hd1440", + "qualityLabel": "1440p60", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 313, + "quality": "hd2160", + "qualityLabel": "2160p", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 315, + "quality": "hd2160", + "qualityLabel": "2160p60", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": "AAC", + "audioQuality": "AUDIO_QUALITY_MEDIUM", + "audioSampleRate": "44100", + "container": "mp4", + "hasAudio": true, + "hasVideo": false, + "itag": 327, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 330, + "quality": "tiny", + "qualityLabel": "144p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 331, + "quality": "small", + "qualityLabel": "240p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 332, + "quality": "medium", + "qualityLabel": "360p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 333, + "quality": "large", + "qualityLabel": "480p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 334, + "quality": "hd720", + "qualityLabel": "720p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 335, + "quality": "hd1080", + "qualityLabel": "1080p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 336, + "quality": "hd1440", + "qualityLabel": "1440p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "webm", + "hasAudio": false, + "hasVideo": true, + "itag": 337, + "quality": "hd2160", + "qualityLabel": "2160p60 HDR", + "videoCodec": "VP9" +}, +{ + "audioBitrate": null, + "audioCodec": "OPUS", + "audioQuality": "AUDIO_QUALITY_MEDIUM", + "audioSampleRate": "48000", + "container": "webm", + "hasAudio": true, + "hasVideo": false, + "itag": 338, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": null, + "hasVideo": null, + "itag": 386, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": null, + "hasVideo": null, + "itag": 387, + "quality": "tiny", + "qualityLabel": null, + "videoCodec": null +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 394, + "quality": "tiny", + "qualityLabel": "144p", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 395, + "quality": "small", + "qualityLabel": "240p", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 396, + "quality": "medium", + "qualityLabel": "360p", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 397, + "quality": "large", + "qualityLabel": "480p", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 398, + "quality": "hd720", + "qualityLabel": "720p60", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 399, + "quality": "hd1080", + "qualityLabel": "1080p60", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 400, + "quality": "hd1440", + "qualityLabel": "1440p60", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 401, + "quality": "hd2160", + "qualityLabel": "2160p60", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 402, + "quality": "highres", + "qualityLabel": "4320p60", + "videoCodec": "AV1" +}, +{ + "audioBitrate": null, + "audioCodec": null, + "audioQuality": null, + "audioSampleRate": null, + "container": "mp4", + "hasAudio": false, + "hasVideo": true, + "itag": 571, + "quality": "highres", + "qualityLabel": "4320p60", + "videoCodec": "AV1" +}] + + +; \ No newline at end of file diff --git a/assets/js/player.js b/assets/js/player.js index 71c5e7da..7a4e3e9d 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -51,10 +51,71 @@ videojs.Vhs.xhr.beforeRequest = function(options) { return options; }; +let htvid = null; + +if(video_data.params.quality === 'directdash'){ + let htsource = document.getElementById("player"); + htsource.innerHTML = ""; + + let req = new XMLHttpRequest(); + req.open("GET", `/api/manifest/dash/id/${video_data.id}`, false); + req.send(); + let dat = req.responseText; + + let matches = [...dat.matchAll(/itag=([0-9]*)/gm)]; + + let itags=[]; + + for(let i = 1; i< matches.length; i+=2){ + let match = matches[i]; + if(match) + itags.push(+match[1]); + } + + console.log(itags); + + for(let i = 0; i < itags.length; i++){ + let itag_info = itag_formats.find(function(a){return a.itag===itags[i]}); + console.log("itaginfo:"); + console.log(itag_info); + if(!itag_info || !itag_info.hasVideo || itag_info.hasAudio) continue; + + let qual = document.createElement("source"); + qual.src = `/latest_version?id=${video_data.id}&itag=${itags[i]}`; + qual.type = `video/${itag_info.container}`; + qual.setAttribute("label", `${itag_info.qualityLabel}`); + htsource.appendChild(qual); + } + + let aud = document.createElement("audio"); + aud.src = `/latest_version?id=${video_data.id}&itag=140`; + aud.id = "seperate_audio"; + document.body.append(aud); + + player.on('pause', ()=>{ + console.log("paused"); + aud.pause(); + }); + + player.on('playing', ()=>{ + console.log("playing"); + aud.play(); + aud.currentTime = htvid.currentTime; + }); + + window.setInterval(()=>{aud.currentTime = htvid.currentTime}, 1000); +} + var player = videojs('player', options); +htvid = document.getElementById("player_html5_api"); + player.on('error', function () { if (video_data.params.quality === 'dash') return; + + // pause audio to be safe + let aud = document.getElementById("seperate_audio"); + try {if(aud) aud.pause()} catch(e){}; var localNotDisabled = ( !player.currentSrc().includes('local=true') && !video_data.local_disabled diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 7a1cf2c3..07903fc4 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -27,6 +27,7 @@ + <%= rendered "components/player_sources" %> <%= title %> - Invidious From 7940bcb16d563851db795dd2a3a7a70c5546496c Mon Sep 17 00:00:00 2001 From: miri Date: Fri, 13 Sep 2024 18:13:54 +0200 Subject: [PATCH 3/9] fix bug with player being undefined --- assets/js/player.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index 7a4e3e9d..ba1eff80 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -92,6 +92,12 @@ if(video_data.params.quality === 'directdash'){ aud.id = "seperate_audio"; document.body.append(aud); + window.setInterval(()=>{aud.currentTime = htvid.currentTime}, 1000); +} + +var player = videojs('player', options); + +if(video_data.params.quality === 'directdash'){ player.on('pause', ()=>{ console.log("paused"); aud.pause(); @@ -102,12 +108,8 @@ if(video_data.params.quality === 'directdash'){ aud.play(); aud.currentTime = htvid.currentTime; }); - - window.setInterval(()=>{aud.currentTime = htvid.currentTime}, 1000); } -var player = videojs('player', options); - htvid = document.getElementById("player_html5_api"); player.on('error', function () { From 3d3f928866cf8bb4c5cb708e50c8b18f8858d4b0 Mon Sep 17 00:00:00 2001 From: miri Date: Fri, 13 Sep 2024 18:19:29 +0200 Subject: [PATCH 4/9] this is why testing things and typeing is a smart idea --- assets/js/player.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/js/player.js b/assets/js/player.js index ba1eff80..8b4c1088 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -98,6 +98,8 @@ if(video_data.params.quality === 'directdash'){ var player = videojs('player', options); if(video_data.params.quality === 'directdash'){ + let aud = document.getElementById("seperate_audio"); + player.on('pause', ()=>{ console.log("paused"); aud.pause(); From 79d1908d943c31e4b724feaab9ad763568f788ea Mon Sep 17 00:00:00 2001 From: miri Date: Sun, 15 Sep 2024 11:27:49 +0200 Subject: [PATCH 5/9] keep audio and video in sync (audio quality may suffer) --- assets/js/player.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index 8b4c1088..27746ca2 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -91,8 +91,6 @@ if(video_data.params.quality === 'directdash'){ aud.src = `/latest_version?id=${video_data.id}&itag=140`; aud.id = "seperate_audio"; document.body.append(aud); - - window.setInterval(()=>{aud.currentTime = htvid.currentTime}, 1000); } var player = videojs('player', options); @@ -101,15 +99,25 @@ if(video_data.params.quality === 'directdash'){ let aud = document.getElementById("seperate_audio"); player.on('pause', ()=>{ - console.log("paused"); + //console.log("paused"); aud.pause(); }); player.on('playing', ()=>{ - console.log("playing"); - aud.play(); + //console.log("playing"); + + aud.playbackRate = htvid.playbackRate; aud.currentTime = htvid.currentTime; + + aud.play(); }); + + // keep audio and video in sync + window.setInterval(()=>{ + if(Math.abs(aud.currentTime - htvid.currentTime) > 0.04) + aud.playbackRate = htvid.playbackRate - (aud.currentTime - htvid.currentTime); + }, 500); + } htvid = document.getElementById("player_html5_api"); From 8d6602717da0add632a93a203273f8bc1027fbbf Mon Sep 17 00:00:00 2001 From: miri Date: Sun, 15 Sep 2024 11:47:43 +0200 Subject: [PATCH 6/9] syncing system doesn't work well, removing --- assets/js/player.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index 27746ca2..2f8208ec 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -111,13 +111,6 @@ if(video_data.params.quality === 'directdash'){ aud.play(); }); - - // keep audio and video in sync - window.setInterval(()=>{ - if(Math.abs(aud.currentTime - htvid.currentTime) > 0.04) - aud.playbackRate = htvid.playbackRate - (aud.currentTime - htvid.currentTime); - }, 500); - } htvid = document.getElementById("player_html5_api"); From 06aeb1d215c1e42455b118395a75882dbf0107b1 Mon Sep 17 00:00:00 2001 From: miri Date: Sun, 15 Sep 2024 12:09:49 +0200 Subject: [PATCH 7/9] added 200ms to currenttime --- assets/js/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/player.js b/assets/js/player.js index 2f8208ec..a9f30b38 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -107,7 +107,7 @@ if(video_data.params.quality === 'directdash'){ //console.log("playing"); aud.playbackRate = htvid.playbackRate; - aud.currentTime = htvid.currentTime; + aud.currentTime = htvid.currentTime + 0.20; aud.play(); }); From fbb17a1171e7a0baa23ecd496659233f5da0d7f7 Mon Sep 17 00:00:00 2001 From: miri Date: Mon, 8 Jul 2024 20:17:59 +0200 Subject: [PATCH 8/9] added loea specific css --- assets/css/default.css | 25 +++++++++++++------------ assets/css/player.css | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 2cedcf0c..299aa194 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -121,6 +121,7 @@ body a.channel-owner { display: flex; justify-content: center; flex-wrap: wrap; + margin-bottom: 8px; } .feed-menu-item { @@ -213,7 +214,7 @@ div.watched-overlay { left: 0; right: 0; bottom: 0; - background-color: rgba(255,255,255,.4); + background-color: rgba(255,255,255, 0); } div.watched-indicator { @@ -238,7 +239,7 @@ div.thumbnail > .bottom-right-overlay { .bottom-right-overlay { bottom: 0.6em; right: 0.6em; } .length { - padding: 1px; + padding: 2px; margin: -2px 0; color: #fff; border-radius: 3px; @@ -471,7 +472,7 @@ footer { } .dark-theme footer { - color: #adadad; + color: #75c8d9; } .light-theme footer a { @@ -632,15 +633,15 @@ span > select { body.dark-theme { background-color: rgba(35, 35, 35, 1); - color: #f0f0f0; + color: #c0ffee; } .dark-theme .pure-form legend { - color: #f0f0f0; + color: #c0ffee; } .dark-theme .pure-menu-heading { - color: #f0f0f0; + color: #c0ffee; } .dark-theme input, @@ -650,7 +651,7 @@ body.dark-theme { } .dark-theme .pure-form input[type="file"] { - color: #f0f0f0; + color: #c0ffee; } .dark-theme .searchbar input { @@ -685,16 +686,16 @@ body.dark-theme { } body.no-theme { - background-color: rgba(35, 35, 35, 1); - color: #f0f0f0; + background-color: rgba(0, 0, 0, 1); + color: #daffff; } .no-theme .pure-form legend { - color: #f0f0f0; + color: #c0ffee; } .no-theme .pure-menu-heading { - color: #f0f0f0; + color: #c0ffee; } .no-theme input, @@ -704,7 +705,7 @@ body.dark-theme { } .no-theme .pure-form input[type="file"] { - color: #f0f0f0; + color: #c0ffee; } .no-theme .searchbar input { diff --git a/assets/css/player.css b/assets/css/player.css index 50c7a748..b2fb8ebf 100644 --- a/assets/css/player.css +++ b/assets/css/player.css @@ -234,6 +234,8 @@ video.video-js { margin-right: 1em; padding-bottom: 82vh; height: 0; + border-radius: 5px; + overflow: hidden; } .mobile-operations-bar { From 0d7a4ac5ca54f22e8729e9961113e8a94d39acc2 Mon Sep 17 00:00:00 2001 From: miri Date: Fri, 13 Sep 2024 14:37:25 +0000 Subject: [PATCH 9/9] revert 4d39aada70fbcbe2c079f2328bbad4450cbdc3fe revert added loea specific css --- assets/css/default.css | 25 ++++++++++++------------- assets/css/player.css | 2 -- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 299aa194..2cedcf0c 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -121,7 +121,6 @@ body a.channel-owner { display: flex; justify-content: center; flex-wrap: wrap; - margin-bottom: 8px; } .feed-menu-item { @@ -214,7 +213,7 @@ div.watched-overlay { left: 0; right: 0; bottom: 0; - background-color: rgba(255,255,255, 0); + background-color: rgba(255,255,255,.4); } div.watched-indicator { @@ -239,7 +238,7 @@ div.thumbnail > .bottom-right-overlay { .bottom-right-overlay { bottom: 0.6em; right: 0.6em; } .length { - padding: 2px; + padding: 1px; margin: -2px 0; color: #fff; border-radius: 3px; @@ -472,7 +471,7 @@ footer { } .dark-theme footer { - color: #75c8d9; + color: #adadad; } .light-theme footer a { @@ -633,15 +632,15 @@ span > select { body.dark-theme { background-color: rgba(35, 35, 35, 1); - color: #c0ffee; + color: #f0f0f0; } .dark-theme .pure-form legend { - color: #c0ffee; + color: #f0f0f0; } .dark-theme .pure-menu-heading { - color: #c0ffee; + color: #f0f0f0; } .dark-theme input, @@ -651,7 +650,7 @@ body.dark-theme { } .dark-theme .pure-form input[type="file"] { - color: #c0ffee; + color: #f0f0f0; } .dark-theme .searchbar input { @@ -686,16 +685,16 @@ body.dark-theme { } body.no-theme { - background-color: rgba(0, 0, 0, 1); - color: #daffff; + background-color: rgba(35, 35, 35, 1); + color: #f0f0f0; } .no-theme .pure-form legend { - color: #c0ffee; + color: #f0f0f0; } .no-theme .pure-menu-heading { - color: #c0ffee; + color: #f0f0f0; } .no-theme input, @@ -705,7 +704,7 @@ body.dark-theme { } .no-theme .pure-form input[type="file"] { - color: #c0ffee; + color: #f0f0f0; } .no-theme .searchbar input { diff --git a/assets/css/player.css b/assets/css/player.css index b2fb8ebf..50c7a748 100644 --- a/assets/css/player.css +++ b/assets/css/player.css @@ -234,8 +234,6 @@ video.video-js { margin-right: 1em; padding-bottom: 82vh; height: 0; - border-radius: 5px; - overflow: hidden; } .mobile-operations-bar {