]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-watch/video-watch.component.ts
Redirect to uuid video route after upload
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / video-watch.component.ts
index 5e4823c9ce24d415ee64f4642ef7f0614aa6048f..adb698e99ac9149710356298c5920fda8e23a9e7 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,14 +288,19 @@ 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) {
+            this.playerElement.poster = this.video.previewUrl
+          }
+
           const videojsOptions = {
             controls: true,
-            autoplay: true,
+            autoplay: this.isAutoplay(),
             plugins: {
               peertube: {
                 videoFiles: this.video.files,
                 playerElement: this.playerElement,
-                autoplay: true,
+                autoplay: this.isAutoplay(),
                 peerTubeLink: false
               }
             }
@@ -373,4 +378,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     }, viewTimeoutSeconds * 1000)
   }
+
+  private isAutoplay () {
+    // True by default
+    if (!this.user) return true
+
+    // Be sure the autoPlay is set to false
+    return this.user.autoPlayVideo !== false
+  }
 }