import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { RedirectService } from '@app/core/routing/redirect.service'
-import { peertubeLocalStorage, peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage'
+import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage'
import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component'
import { MetaService } from '@ngx-meta/core'
import { AuthUser, Notifier, ServerService } from '@app/core'
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
import { AuthService, ConfirmService } from '../../core'
-import { RestExtractor } from '../../shared'
+import { RestExtractor, UserService } from '../../shared'
import { VideoDetails } from '../../shared/video/video-details.model'
import { VideoService } from '../../shared/video/video.service'
import { VideoShareComponent } from './modal/video-share.component'
import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
import { HooksService } from '@app/core/plugins/hooks.service'
import { PlatformLocation } from '@angular/common'
-import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
import { scrollToTop, isXPercentInViewport } from '@app/shared/misc/utils'
@Component({
private confirmService: ConfirmService,
private metaService: MetaService,
private authService: AuthService,
+ private userService: UserService,
private serverService: ServerService,
private restExtractor: RestExtractor,
private notifier: Notifier,
return this.authService.getUser()
}
+ get anonymousUser () {
+ return this.userService.getAnonymousUser()
+ }
+
async ngOnInit () {
this.serverConfig = this.serverService.getTmpConfig()
this.redirectService.redirectToHomepage()
}
+ declinedPrivacyConcern () {
+ peertubeLocalStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'false')
+ this.hasAlreadyAcceptedPrivacyConcern = false
+ }
+
acceptedPrivacyConcern () {
peertubeLocalStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
this.hasAlreadyAcceptedPrivacyConcern = true
isAutoPlayEnabled () {
return (
(this.user && this.user.autoPlayNextVideo) ||
- peertubeSessionStorage.getItem(RecommendedVideosComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true'
+ this.anonymousUser.autoPlayNextVideo
)
}
isPlaylistAutoPlayEnabled () {
return (
(this.user && this.user.autoPlayNextVideoPlaylist) ||
- peertubeSessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true'
+ this.anonymousUser.autoPlayNextVideoPlaylist
)
}
}
private autoplayNext () {
- if (this.nextVideoUuid) {
+ if (this.playlist) {
+ this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
+ } else if (this.nextVideoUuid) {
this.router.navigate([ '/videos/watch', this.nextVideoUuid ])
}
}