Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/hossainemruz/toha.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid G. Simmons <davidgs@users.noreply.github.com>2021-04-05 22:12:28 +0300
committerGitHub <noreply@github.com>2021-04-05 22:12:28 +0300
commit6996894ec1025f8c23c67340fef73a4b1e906cd6 (patch)
tree0b3453e4c484b23c0527fadbdf66d426f090ab7d /layouts/shortcodes
parentd38634df8dfe689f1ee00106140d86a1196a0f2c (diff)
add video shortcode (#289)
* add video shortcode * Use "sampotts/plyr" library instead of "clappr/clappr" Signed-off-by: hossainemruz <hossainemruz@gmail.com> Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/video.html13
1 files changed, 13 insertions, 0 deletions
diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html
new file mode 100644
index 0000000..b42d10f
--- /dev/null
+++ b/layouts/shortcodes/video.html
@@ -0,0 +1,13 @@
+{{ $src := .Get "src" }}
+{{ $type := .Get "type" }}
+{{/*
+ A page can have multiple videos. We need to generate unique id for them.
+ Here, we are generating a sequence from 1 to 200 and taking the first element after a shuffle.
+ This will give a random number in most cases. However, if the page has many videos, we might have a collision.
+ We should find a better approach for doing this.
+*/}}
+{{ $randNumber := index (seq 200 | shuffle) 0 }}
+
+<video class="video-player" id="video-{{ $randNumber }}" playsinline controls>
+ <source src="{{ $src }}" type="{{ $type | default "video/mp4" }}" />
+</video>