From 0826c92d6fd327f9abcdda1054808a6b2587848d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Dec 2017 09:57:00 +0100 Subject: [PATCH] Add poster for video watch --- .../src/app/videos/+video-watch/video-watch.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 3b5edc27a..5e2683334 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -33,7 +33,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { error = false loading = false player: videojs.Player - playerElement: HTMLMediaElement + playerElement: HTMLVideoElement userRating: UserVideoRateType = null video: VideoDetails = null videoPlayerLoaded = false @@ -288,6 +288,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { if (this.videoPlayerLoaded !== true) { this.playerElement = this.elementRef.nativeElement.querySelector('#video-element') + // If autoplay is true, we don't really need a poster + if (this.isAutoplay() === false) { + console.log('coucou') + this.playerElement.poster = this.video.previewUrl + } + const videojsOptions = { controls: true, autoplay: this.isAutoplay(), -- 2.25.1