]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix bug when quitting NSFW video
authorChocobozzz <florian.bigard@gmail.com>
Thu, 19 Oct 2017 13:39:08 +0000 (15:39 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Thu, 19 Oct 2017 13:39:08 +0000 (15:39 +0200)
client/src/app/videos/+video-watch/video-watch.component.ts

index 651298c14005d80b12bd8b754bd19d5b4a9b8e9e..8b5abc3f37f4f1566c96baa9059bc7a03a741425 100644 (file)
@@ -36,7 +36,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
   uploadSpeed: number
   userRating: UserVideoRateType = null
   video: Video = null
-  videoNotFound = false
+  videoPlayerLoaded = false
 
   private paramsSub: Subscription
 
@@ -58,17 +58,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
       this.videoService.getVideo(uuid).subscribe(
         video => this.onVideoFetched(video),
 
-        error => {
-          console.error(error)
-          this.videoNotFound = true
-        }
+        error => console.error(error)
       )
     })
   }
 
   ngOnDestroy () {
     // Remove player if it exists
-    if (this.videoNotFound === false) {
+    if (this.videoPlayerLoaded === true) {
       videojs(this.playerElement).dispose()
     }
 
@@ -223,6 +220,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     observable.subscribe(
       res => {
         if (res === false) {
+
           return this.router.navigate([ '/videos/list' ])
         }
 
@@ -241,6 +239,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
           }
         }
 
+        this.videoPlayerLoaded = true
+
         const self = this
         videojs(this.playerElement, videojsOptions, function () {
           self.player = this