import { HooksService } from '@app/core/plugins/hooks.service'
import { PlatformLocation } from '@angular/common'
import { randomInt } from '@shared/core-utils/miscs/miscs'
+import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
@Component({
selector: 'my-video-watch',
})
export class VideoWatchComponent implements OnInit, OnDestroy {
private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern'
+ private static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO = 'auto_play_next_video'
@ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent
@ViewChild('videoShareModal', { static: false }) videoShareModal: VideoShareComponent
this.player.one('ended', () => {
if (this.playlist) {
- this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
- } else if (this.user && this.user.autoPlayNextVideo) {
+ if (
+ this.user && this.user.autoPlayNextVideoPlaylist ||
+ peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true'
+ ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
+ } else if (
+ this.user && this.user.autoPlayNextVideo ||
+ peertubeLocalStorage.getItem(RecommendedVideosComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true'
+ ) {
this.zone.run(() => this.autoplayNext())
}
})
this.player.one('stopped', () => {
if (this.playlist) {
- this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
+ if (
+ this.user && this.user.autoPlayNextVideoPlaylist ||
+ peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true'
+ ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
}
})