]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix anonymous autoplay
authorChocobozzz <me@florianbigard.com>
Thu, 13 Jul 2023 12:40:06 +0000 (14:40 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 17 Jul 2023 09:31:46 +0000 (11:31 +0200)
client/src/app/+videos/+video-watch/video-watch.component.ts

index e0935abd76270893ede5df960d97247b34ecb8b4..45de62519cbec098bb7687557d4381fa6925712d 100644 (file)
@@ -567,11 +567,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     // We'll jump to the thread id, so do not play the video
     if (this.route.snapshot.params['threadId']) return false
 
-    // Otherwise true by default
-    if (!this.user) return true
+    if (this.user) return this.user.autoPlayVideo
 
-    // Be sure the autoPlay is set to false
-    return this.user.autoPlayVideo !== false
+    if (this.anonymousUser) return this.anonymousUser.autoPlayVideo
+
+    throw new Error('Cannot guess autoplay because user and anonymousUser are not defined')
   }
 
   private isAutoPlayNext () {