From 644e077f7772e93812d18f8eae2da808a05aaaf1 Mon Sep 17 00:00:00 2001 From: Eir Sunny Date: Thu, 19 Dec 2024 21:27:26 -0600 Subject: [PATCH] Play YT stream first if downloading --- html/static/js/player/quality.js | 9 +++++---- pug/video.pug | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/html/static/js/player/quality.js b/html/static/js/player/quality.js index d1c150f..c7937c2 100755 --- a/html/static/js/player/quality.js +++ b/html/static/js/player/quality.js @@ -96,12 +96,13 @@ export default (modules, q, qa) => { waitForNewVideoLoad: (videoName, quality) => { modules.cacheInfo.pingCache(`${videoName}-${quality}`, () => self.videoDownloaded(`/getVideo?v=${videoName}&q=${quality}`, quality), 1000 * 3) }, - setVideoSource: newSource => { + setVideoSource: (newSource, dontReload) => { videoSource = newSource - self.reloadSource() + if (!dontReload) + self.reloadSource() }, - videoDownloaded: (videoName, quality) => { - self.setVideoSource(videoName) + videoDownloaded: (videoName, quality, initial) => { + self.setVideoSource(videoName, initial) self.safeQualities[quality] = true modules.controls.onVideoDownloaded(quality) diff --git a/pug/video.pug b/pug/video.pug index 99eebf5..71af71d 100755 --- a/pug/video.pug +++ b/pug/video.pug @@ -60,7 +60,7 @@ block content if targetFormat .video-container-inner video(controls playsinline preload="auto" width=targetFormat.second__width height=targetFormat.second__height data-itag=targetFormat.itag autoplay=continuous||autoplay).video - source(type=targetFormat.type src=`${videoPath}${mediaFragment}`) + source(type=targetFormat.type src=(dlStatus < 2 ? startingFormat.url : `${videoPath}${mediaFragment}`)) //- source(type=targetFormat.type) each t in video.captions track(label=t.label kind="subtitles" srclang=t.languageCode src=t.url)