Play YT stream first if downloading

This commit is contained in:
Eir Sunny 2024-12-19 21:27:26 -06:00
parent ce11918e4e
commit 644e077f77
2 changed files with 6 additions and 5 deletions

View File

@ -96,12 +96,13 @@ export default (modules, q, qa) => {
waitForNewVideoLoad: (videoName, quality) => { waitForNewVideoLoad: (videoName, quality) => {
modules.cacheInfo.pingCache(`${videoName}-${quality}`, () => self.videoDownloaded(`/getVideo?v=${videoName}&q=${quality}`, quality), 1000 * 3) modules.cacheInfo.pingCache(`${videoName}-${quality}`, () => self.videoDownloaded(`/getVideo?v=${videoName}&q=${quality}`, quality), 1000 * 3)
}, },
setVideoSource: newSource => { setVideoSource: (newSource, dontReload) => {
videoSource = newSource videoSource = newSource
if (!dontReload)
self.reloadSource() self.reloadSource()
}, },
videoDownloaded: (videoName, quality) => { videoDownloaded: (videoName, quality, initial) => {
self.setVideoSource(videoName) self.setVideoSource(videoName, initial)
self.safeQualities[quality] = true self.safeQualities[quality] = true
modules.controls.onVideoDownloaded(quality) modules.controls.onVideoDownloaded(quality)

View File

@ -60,7 +60,7 @@ block content
if targetFormat if targetFormat
.video-container-inner .video-container-inner
video(controls playsinline preload="auto" width=targetFormat.second__width height=targetFormat.second__height data-itag=targetFormat.itag autoplay=continuous||autoplay).video 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) //- source(type=targetFormat.type)
each t in video.captions each t in video.captions
track(label=t.label kind="subtitles" srclang=t.languageCode src=t.url) track(label=t.label kind="subtitles" srclang=t.languageCode src=t.url)