blob: 6d62abb96a70d87854e38a1b7e441dec2236bf34 (
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
41
42
43
44
|
{{-
$source := default
"https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny.mp4"
(.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)) -}}
{{- $path := replace (path.Dir $source) ":/" "://" 1 -}}
{{- $base := split (path.Base $source) "." -}}
{{- $name := index (first (sub (len $base) 1) $base) 0 -}}
{{- $mime := path.Ext $source -}}
{{- $source = print $path "/" $name -}}
<video-container>
<video
title="{{ $title }}"
preload="{{ $preload }}"
poster="{{ $poster }}"
width="{{ $width }}"
height="{{ $height }}"
controls="{{ $controls | safeHTMLAttr }}">
<source src="{{ $source}}{{ $mime }}#t={{ $start }},{{ $end }}" type="video/{{ $mime }}">
<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 does not support embedded videos. Here is a
<a href="{{ $source }}{{ $mime }}#t={{ $start }},{{ $end }}">link to the video</a> instead.
</p>
</video>
<figcaption>
{{ $caption | markdownify }}:
{{ print "[Link](" $source $mime ")" | markdownify }}
</figcaption>
</video-container>
|