mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 15:47:30 +00:00
Fix #14 implement video autoplay with URL parameter
Fixes https://todo.sr.ht/~cadence/tube/14
This commit is contained in:
parent
d1e2202cae
commit
8292c8db57
@ -190,6 +190,7 @@ module.exports = [
|
|||||||
|
|
||||||
// Continuous mode
|
// Continuous mode
|
||||||
const continuous = url.searchParams.get("continuous") === "1"
|
const continuous = url.searchParams.get("continuous") === "1"
|
||||||
|
const autoplay = url.searchParams.get("autoplay") === "1"
|
||||||
const swp = url.searchParams.get("session-watched")
|
const swp = url.searchParams.get("session-watched")
|
||||||
const sessionWatched = swp ? swp.split(" ") : []
|
const sessionWatched = swp ? swp.split(" ") : []
|
||||||
const sessionWatchedNext = sessionWatched.concat([id]).join("+")
|
const sessionWatchedNext = sessionWatched.concat([id]).join("+")
|
||||||
@ -210,7 +211,7 @@ module.exports = [
|
|||||||
return renderVideo(video, {
|
return renderVideo(video, {
|
||||||
user, settings, id, instanceOrigin
|
user, settings, id, instanceOrigin
|
||||||
}, {
|
}, {
|
||||||
mediaFragment, continuous, sessionWatched, sessionWatchedNext
|
mediaFragment, autoplay, continuous, sessionWatched, sessionWatchedNext
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ block content
|
|||||||
.video-container
|
.video-container
|
||||||
- const format = formats[0]
|
- const format = formats[0]
|
||||||
if format
|
if format
|
||||||
video(controls preload="auto" width=format.second__width height=format.second__height data-itag=format.itag autoplay=continuous)#video.video
|
video(controls preload="auto" width=format.second__width height=format.second__height data-itag=format.itag autoplay=continuous||autoplay)#video.video
|
||||||
source(src=format.url+mediaFragment type=format.type)
|
source(src=format.url+mediaFragment type=format.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)
|
||||||
|
Loading…
Reference in New Issue
Block a user