aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes/video.html
blob: 7c0c95f8153f98c056a59cf532307ce1e1e51894 (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
{{-
  $source  := default
  "https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny"
  (.Get "source"  | default (.Get 0))
-}}
{{- $poster   := default ""               (.Get "poster"   | default (.Get 1)) -}}
{{- $width    := default ""               (.Get "width"    | default (.Get 2)) -}}
{{- $height   := default ""               (.Get "height"   | default (.Get 3)) -}}
{{- $preload  := default "metadata"       (.Get "preload"  | default (.Get 4)) -}}
{{- $controls := default ""               (.Get "controls" | default (.Get 5)) -}}
{{- $caption  := default "`HTML5` Video"  (.Get "caption"  | default (.Get 6)) -}}
{{- $title    := default "HTML5 Video"    (.Get "title"    | default (.Get 7)) -}}
{{- $start    := default ""               (.Get "start"    | default (.Get 8)) -}}
{{- $end      := default ""               (.Get "end"      | default (.Get 9)) -}}

<video-container>
  <video
    title="{{ $title }}"
    preload="{{ $preload }}"
    poster="{{ $poster }}"
    width="{{ $width }}"
    height="{{ $height }}"
    controls {{ $controls | safeHTMLAttr }}>
      <source src="{{ $source }}.mp4#t={{  $start }},{{ $end }}" type="video/mp4">
      <source src="{{ $source }}.webm#t={{ $start }},{{ $end }}" type="video/webm">
      <source src="{{ $source }}.flv#t={{  $start }},{{ $end }}" type="video/flv">
      <source src="{{ $source }}.ogv#t={{  $start }},{{ $end }}" type="video/ogv">
    <p>
      Sorry, your browser doesn't support embedded videos. Here is a
      <a href="{{ $source }}.mp4#t={{  $start }},{{ $end }}">
        link to the video
      </a> instead.
    </p>
  </video>
  <figcaption>{{ $caption | markdownify }}</figcaption>
</video-container>