aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/video-container.html
blob: 44bbf6b3b615d45f4c28407c56943e59ee4b56c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{{- $cache     := "" -}}
{{- $caption   := .Caption -}}
{{- $public    := print "public/" .Source -}}
{{- $timestamp := print "#t=" .Start "," .End -}}

{{- with $remote := resources.GetRemote .Source -}}
  {{- with .Err -}}
    {{- if fileExists $public -}}
    {{- else -}}
      {{ $caption = "No local video data found for source" }}
    {{- end -}}
  {{- else -}}
  {{ end }}
  {{- $cache = .Content | resources.FromString (print $.Author "/media/" (. | urlize)) -}}
  {{- $cache = $cache.RelPermalink }}
{{ else }}
  {{ $caption = "No remote video data found for source" }}
{{- end -}}

<video-container>
  <video
    title="{{ .Title }}"
    preload="{{ .Preload }}"
    {{ with .Poster }} poster="{{ . }}" {{ end -}}
    {{ with .Width }} width="{{ . }}" {{ end -}}
    {{ with .Height }} height="{{ . }}" {{ end -}}
    {{ .Options | safeHTMLAttr }}>
      <source src="{{ or .Source .Cache }}{{ $timestamp }}">
      <p>
        Sorry, your browser does not support embedded videos. Here is a
        <a href="{{ .Source }}">link to the video</a> instead.
      </p>
  </video>
  <footer>
    {{ $caption | markdownify }}
    <br>
    Index: {{ with $cache }} {{ print "[Cache](" . ")" | markdownify }} &middot; {{ end }}
    {{ print "[Source](" .Source ")" | markdownify }}
  </footer>
</video-container>