Add poster for video watch
authorChocobozzz <me@florianbigard.com>
Wed, 20 Dec 2017 08:57:00 +0000 (09:57 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 20 Dec 2017 09:00:07 +0000 (10:00 +0100)
client/src/app/videos/+video-watch/video-watch.component.ts

index 3b5edc27a86bf17a9d5b6b4bf0a3efcc12f5c8c5..5e2683334f7f6a7a40d70f2d560d55d88879f68d 100644 (file)
@@ -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(),