Initial hls video playback support
This commit is contained in:
@@ -17,13 +17,17 @@ proc renderNavbar*(title: string): VNode =
|
||||
icon "info-circled", title="About", href="/about"
|
||||
icon "cog-2", title="Preferences", href="/settings"
|
||||
|
||||
proc renderMain*(body: VNode; title="Nitter"; titleText=""; desc="";
|
||||
proc renderMain*(body: VNode; prefs: Prefs; title="Nitter"; titleText=""; desc="";
|
||||
`type`="article"; video=""; images: seq[string] = @[]): string =
|
||||
let node = buildHtml(html(lang="en")):
|
||||
head:
|
||||
link(rel="stylesheet", `type`="text/css", href="/css/style.css")
|
||||
link(rel="stylesheet", `type`="text/css", href="/css/fontello.css")
|
||||
|
||||
if prefs.hlsPlayback:
|
||||
script(src="/js/hls.light.min.js")
|
||||
script(src="/js/hlsPlayback.js")
|
||||
|
||||
title:
|
||||
if titleText.len > 0:
|
||||
text titleText & " | " & title
|
||||
@@ -63,4 +67,4 @@ proc renderError*(error: string): VNode =
|
||||
span: text error
|
||||
|
||||
proc showError*(error, title: string): string =
|
||||
renderMain(renderError(error), title, "Error")
|
||||
renderMain(renderError(error), Prefs(), title, "Error")
|
||||
|
||||
@@ -76,9 +76,10 @@ proc renderVideo(video: Video; prefs: Prefs): VNode =
|
||||
video(poster=thumb, controls=""):
|
||||
source(src=source, `type`="video/mp4")
|
||||
of m3u8, vmap:
|
||||
video(poster=thumb)
|
||||
tdiv(class="video-overlay"):
|
||||
p: text "Video playback not supported yet"
|
||||
video(poster=thumb, data-url=source, data-autoload="false")
|
||||
verbatim "<div class=\"video-overlay\" onclick=\"playVideo(this)\">"
|
||||
verbatim "<div class=\"card-overlay-circle\">"
|
||||
verbatim "<span class=\"card-overlay-triangle\"</span></div></div>"
|
||||
else:
|
||||
renderVideoDisabled(video)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user