Notifier,
PeerTubeSocket,
RestExtractor,
+ ScreenService,
ServerService,
UserService
} from '@app/core'
player: any
playerElement: HTMLVideoElement
+
theaterEnabled = false
+
userRating: UserVideoRateType = null
- descriptionLoading = false
+
+ playerPlaceholderImgSrc: string
video: VideoDetails = null
videoCaptions: VideoCaption[] = []
playlistPosition: number
playlist: VideoPlaylist = null
+ descriptionLoading = false
completeDescriptionShown = false
completeVideoDescription: string
shortVideoDescription: string
videoHTMLDescription = ''
+
likesBarTooltipText = ''
+
hasAlreadyAcceptedPrivacyConcern = false
remoteServerDown = false
+
hotkeys: Hotkey[] = []
tooltipLike = ''
private hotkeysService: HotkeysService,
private hooks: HooksService,
private peertubeSocket: PeerTubeSocket,
+ private screenService: ScreenService,
private location: PlatformLocation,
@Inject(LOCALE_ID) private localeId: string
- ) {
- this.tooltipLike = $localize`Like this video`
- this.tooltipDislike = $localize`Dislike this video`
- this.tooltipSupport = $localize`Support options for this video`
- this.tooltipSaveToPlaylist = $localize`Save to playlist`
- }
+ ) { }
get user () {
return this.authService.getUser()
}
async ngOnInit () {
+ // Hide the tooltips for unlogged users in mobile view, this adds confusion with the popover
+ if (this.user || !this.screenService.isInMobileView()) {
+ this.tooltipLike = $localize`Like this video`
+ this.tooltipDislike = $localize`Dislike this video`
+ this.tooltipSupport = $localize`Support options for this video`
+ this.tooltipSaveToPlaylist = $localize`Save to playlist`
+ }
+
PeertubePlayerManager.initState()
this.serverConfig = this.serverService.getTmpConfig()
this.videoCaptions = videoCaptions
// Re init attributes
+ this.playerPlaceholderImgSrc = undefined
this.descriptionLoading = false
this.completeDescriptionShown = false
+ this.completeVideoDescription = undefined
this.remoteServerDown = false
this.currentTime = undefined
if (res === false) return this.location.back()
}
- const videoState = this.video.state.id
- if (videoState === VideoState.LIVE_ENDED || videoState === VideoState.WAITING_FOR_LIVE) return
+ this.buildPlayer(urlOptions)
+ .catch(err => console.error('Cannot build the player', err))
+
+ this.setVideoDescriptionHTML()
+ this.setVideoLikesBarTooltipText()
+
+ this.setOpenGraphTags()
+ this.checkUserRating()
+
+ this.hooks.runAction('action:video-watch.video.loaded', 'video-watch', { videojs })
+ }
+ private async buildPlayer (urlOptions: URLOptions) {
// Flush old player if needed
this.flushPlayer()
+ const videoState = this.video.state.id
+ if (videoState === VideoState.LIVE_ENDED || videoState === VideoState.WAITING_FOR_LIVE) {
+ this.playerPlaceholderImgSrc = this.video.previewPath
+ return
+ }
+
// Build video element, because videojs removes it on dispose
const playerElementWrapper = this.elementRef.nativeElement.querySelector('#videojs-wrapper')
this.playerElement = document.createElement('video')
const params = {
video: this.video,
- videoCaptions,
+ videoCaptions: this.videoCaptions,
urlOptions,
user: this.user
}
this.hooks.runAction('action:video-watch.player.loaded', 'video-watch', { player: this.player, videojs, video: this.video })
})
-
- this.setVideoDescriptionHTML()
- this.setVideoLikesBarTooltipText()
-
- this.setOpenGraphTags()
- this.checkUserRating()
-
- this.hooks.runAction('action:video-watch.video.loaded', 'video-watch', { videojs })
}
private autoplayNext () {