From bc640b96052d657d22e0afbc05dc1ab4d0289bfb Mon Sep 17 00:00:00 2001
From: pacien
Date: Tue, 19 May 2020 21:10:37 +0200
Subject: viewer/LdVideoViewer: add video viewer

GitHub: closes #222
---
 viewer/src/components/LdVideoViewer.vue | 50 +++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 viewer/src/components/LdVideoViewer.vue

(limited to 'viewer/src/components/LdVideoViewer.vue')

diff --git a/viewer/src/components/LdVideoViewer.vue b/viewer/src/components/LdVideoViewer.vue
new file mode 100644
index 0000000..49f687f
--- /dev/null
+++ b/viewer/src/components/LdVideoViewer.vue
@@ -0,0 +1,50 @@
+<!--
+-- ldgallery - A static generator which turns a collection of tagged
+--             pictures into a searchable web gallery.
+--
+-- Copyright (C) 2020  Pacien TRAN-GIRARD
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU Affero General Public License as
+-- published by the Free Software Foundation, either version 3 of the
+-- License, or (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU Affero General Public License for more details.
+--
+-- You should have received a copy of the GNU Affero General Public License
+-- along with this program.  If not, see <https://www.gnu.org/licenses/>.
+-->
+
+<template>
+  <!-- intermediate container necessary to eliminate the scrollbar -->
+  <div class="fill no-scroll">
+    <video class="fill" :src="itemResourceUrl()" :poster="thumbnailResourceUrl()" preload="auto" controls>
+      <ld-download :item="videoItem" />
+    </video>
+  </div>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue } from "vue-property-decorator";
+
+@Component export default class LdVideoViewer extends Vue {
+  @Prop({ required: true }) readonly videoItem!: Gallery.Video;
+
+  itemResourceUrl(): string {
+    return this.$galleryStore.resourceRoot + this.videoItem.properties.resource;
+  }
+
+  thumbnailResourceUrl(): string {
+    return this.videoItem.thumbnail
+      ? this.$galleryStore.resourceRoot + this.videoItem.thumbnail.resource
+      : "";
+  }
+}
+</script>
+
+<style lang="scss" module>
+
+</style>
-- 
cgit v1.2.3

