From 43f61d2635113001c3d19e3299d8700a00d47e48 Mon Sep 17 00:00:00 2001
From: Chocobozzz <florian.bigard@gmail.com>
Date: Wed, 12 Jul 2017 12:16:13 +0200
Subject: Add preview to embed

---
 client/src/app/videos/shared/video.model.ts | 5 +++++
 client/src/standalone/videos/embed.html     | 7 +++----
 2 files changed, 8 insertions(+), 4 deletions(-)

(limited to 'client/src')

diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 9ed6a0641..f0556343f 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -23,6 +23,8 @@ export class Video implements VideoServerModel {
   tags: string[]
   thumbnailPath: string
   thumbnailUrl: string
+  previewPath: string
+  previewUrl: string
   views: number
   likes: number
   dislikes: number
@@ -60,6 +62,7 @@ export class Video implements VideoServerModel {
     podHost: string,
     tags: string[],
     thumbnailPath: string,
+    previewPath: string,
     views: number,
     likes: number,
     dislikes: number,
@@ -85,6 +88,8 @@ export class Video implements VideoServerModel {
     this.tags = hash.tags
     this.thumbnailPath = hash.thumbnailPath
     this.thumbnailUrl = API_URL + hash.thumbnailPath
+    this.previewPath = hash.previewPath
+    this.previewUrl = API_URL + hash.previewPath
     this.views = hash.views
     this.likes = hash.likes
     this.dislikes = hash.dislikes
diff --git a/client/src/standalone/videos/embed.html b/client/src/standalone/videos/embed.html
index 0a1c3eadf..365dc3fa2 100644
--- a/client/src/standalone/videos/embed.html
+++ b/client/src/standalone/videos/embed.html
@@ -88,10 +88,9 @@
 
   loadVideoInfos(videoId, function (videoInfos) {
     var magnetUri = videoInfos.magnetUri
-    // FIXME: use poster?
-    // var videoContainer = document.getElementById('video-container')
-    // var thumbnailUrl = 'http://' + videoInfos.podUrl + videoInfos.thumbnailPath
-    // videoContainer.poster = thumbnailUrl
+    var videoContainer = document.getElementById('video-container')
+    var previewUrl = window.location.protocol + '//' + videoInfos.podHost + videoInfos.previewPath
+    videoContainer.poster = previewUrl
 
     videojs('video-container', { controls: true, autoplay: false }, function () {
       var player = this
-- 
cgit v1.2.3