1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-14 12:27:28 +00:00
cloudtube/pug/video.pug

110 lines
4.6 KiB
Plaintext
Raw Normal View History

2020-08-30 13:54:59 +00:00
extends includes/layout
2020-08-22 13:17:31 +00:00
2020-08-30 13:54:59 +00:00
include includes/video-list-item
include includes/subscribe-button
2020-08-24 10:43:55 +00:00
2020-08-22 13:17:31 +00:00
block head
2020-08-31 13:22:16 +00:00
unless error
title= `${video.title} - CloudTube`
else
title Error - CloudTube
2020-08-22 13:17:31 +00:00
script(type="module" src=getStaticURL("html", "/static/js/player.js"))
script(type="module" src=getStaticURL("html", "/static/js/chapter-highlight.js"))
2021-04-25 12:02:59 +00:00
script const data = !{JSON.stringify({...video, continuous})}
2020-08-22 13:17:31 +00:00
block content
2020-08-31 13:22:16 +00:00
unless error
2021-04-25 12:02:59 +00:00
if continuous
- const first = video.recommendedVideos[0]
if first
script(type="module" src=getStaticURL("html", "/static/js/continuous.js"))
noscript
meta(http-equiv="refresh" content=`${video.lengthSeconds+5};url=/watch?v=${first.videoId}&continuous=1&session-watched=${sessionWatchedNext}`)
2020-08-31 13:22:16 +00:00
main.video-page
.main-video-section
.video-container
- const format = formats[0]
if format
video(controls preload="auto" width=format.second__width height=format.second__height data-itag=format.itag autoplay=continuous||autoplay)#video.video
2021-05-01 12:59:28 +00:00
source(src=format.url type=format.type)
each t in video.captions
track(label=t.label kind="subtitles" srclang=t.languageCode src=t.url)
else
video(src="")#video.video
.stream-notice The server provided no playback streams.
2020-08-31 13:22:16 +00:00
#current-time-container
#end-cards-container
.info
header.info-main
h1.title= video.title
.author
a(href=`/channel/${video.authorId}`).author-link= `Uploaded by ${video.author}`
.info-secondary
- const date = new Date(video.published*1000)
- const month = new Intl.DateTimeFormat("en-US", {month: "short"}).format(date.getTime())
div= `Uploaded ${date.getUTCDate()} ${month} ${date.getUTCFullYear()}`
div= video.second__viewCountText
div(style=`--rating: ${video.rating*20}%`)#rating-bar.rating-bar
audio(preload="auto")#audio
#live-event-notice
#audio-loading-display
2021-04-25 12:02:59 +00:00
if continuous
div#continuous-controls.continuous
.continuous__description
.continuous__title Continuous mode: next video autoplays
noscript
.continuous__script-warning Without JavaScript, it will trigger on a timer, not on video completion.
.continuous__buttons
a(href=`/watch?v=${video.videoId}`)#continuous-stop.border-look Turn off
2020-08-31 13:22:16 +00:00
.button-container
+subscribe_button(video.authorId, subscribed, `/watch?v=${video.videoId}`).border-look
//- button.border-look#theatre Theatre
select(autocomplete="off").border-look#quality-select
each f in formats
option(value=f.itag)= f.cloudtube__label
2020-08-31 13:22:16 +00:00
//-
a(href="/subscriptions").border-look
img(src="/static/images/search.svg" width=17 height=17 alt="").button-icon
| Search
//- button.border-look#share Share
a(href=`https://www.youtube.com/watch?v=${video.videoId}#cloudtube`).border-look YouTube
2021-01-25 00:50:47 +00:00
a(href=`https://redirect.invidious.io/watch?v=${video.videoId}`).border-look Invidious
2020-08-31 13:22:16 +00:00
.description#description!= video.descriptionHtml
2020-08-31 13:22:16 +00:00
2021-04-25 12:02:59 +00:00
//- Standard view
aside(style=continuous ? "display: none" : "")#standard-related-videos.related-videos
.related-cols
h2.related-header Related videos
if video.recommendedVideos.length
.continuous-start
a(href=`/watch?v=${video.videoId}&continuous=1` nofollow) Continuous mode
2020-08-31 13:22:16 +00:00
each r in video.recommendedVideos
+video_list_item("related-video", r, instanceOrigin)
2020-08-31 13:22:16 +00:00
2021-04-25 12:02:59 +00:00
//- Continuous view
if continuous
aside.related-videos#continuous-related-videos
- let column = video.recommendedVideos.filter(v => !sessionWatched.includes(v.videoId))
if column.length
.related-cols
h2.related-header Autoplay next
#continuous-first
+video_list_item("related-video", column.shift(), instanceOrigin, {continuous: true})
2021-04-25 12:02:59 +00:00
if column.length
.related-cols
h2.related-header Related videos
each r in column
+video_list_item("related-video", r, instanceOrigin, {continuous: true}) // keep on continuous mode for all recommendations
2020-08-31 13:22:16 +00:00
else
//- error
main.video-error-page
h2 Error
!= message
2020-09-23 11:45:02 +00:00
p: a(href=`https://www.youtube.com/watch?v=${video.videoId}#cloudtube`) Watch on YouTube →