UserService
} from '@app/core'
import { HooksService } from '@app/core/plugins/hooks.service'
-import { RedirectService } from '@app/core/routing/redirect.service'
import { isXPercentInViewport, scrollToTop } from '@app/helpers'
import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main'
-import { VideoShareComponent } from '@app/shared/shared-share-modal'
-import { SupportModalComponent } from '@app/shared/shared-support-modal'
import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
-import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature'
+import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
-import {
- HTMLServerConfig,
- PeerTubeProblemDocument,
- ServerErrorCode,
- UserVideoRateType,
- VideoCaption,
- VideoPrivacy,
- VideoState
-} from '@shared/models'
+import { HTMLServerConfig, PeerTubeProblemDocument, ServerErrorCode, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'
import { cleanupVideoWatch, getStoredTheater, getStoredVideoWatchHistory } from '../../../assets/player/peertube-player-local-storage'
import {
CustomizationOptions,
})
export class VideoWatchComponent implements OnInit, OnDestroy {
@ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent
- @ViewChild('videoShareModal') videoShareModal: VideoShareComponent
- @ViewChild('supportModal') supportModal: SupportModalComponent
@ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
- @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
player: any
playerElement: HTMLVideoElement
liveInfo: true
}
- userRating: UserVideoRateType
-
private nextVideoUuid = ''
private nextVideoTitle = ''
private currentTime: number
private restExtractor: RestExtractor,
private notifier: Notifier,
private zone: NgZone,
- private redirectService: RedirectService,
private videoCaptionService: VideoCaptionService,
private hotkeysService: HotkeysService,
private hooks: HooksService,
this.hotkeysService.remove(this.hotkeys)
}
- showDownloadModal () {
- this.videoDownloadModal.show(this.video, this.videoCaptions)
- }
-
- isVideoDownloadable () {
- return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled && !this.video.isLive
+ getCurrentTime () {
+ return this.currentTime
}
- showSupportModal () {
- this.supportModal.show()
- }
-
- showShareModal () {
- this.videoShareModal.show(this.currentTime, this.videoWatchPlaylist.currentPlaylistPosition)
+ getCurrentPlaylistPosition () {
+ return this.videoWatchPlaylist.currentPlaylistPosition
}
isUserLoggedIn () {
}
}
- onVideoRemoved () {
- this.redirectService.redirectToHomepage()
- }
-
isVideoToTranscode () {
return this.video && this.video.state.id === VideoState.TO_TRANSCODE
}
return this.video && this.video.scheduledUpdate !== undefined
}
- isLive () {
- return !!(this.video?.isLive)
- }
-
isWaitingForLive () {
return this.video?.state.id === VideoState.WAITING_FOR_LIVE
}
this.loadVideo(videoId)
}
- onRateUpdated (userRating: UserVideoRateType) {
- this.userRating = userRating
- this.setVideoLikesBarTooltipText()
- }
-
displayOtherVideosAsRow () {
// Use the same value as in the SASS file
return this.screenService.getWindowInnerWidth() <= 1100
})
}
- private setVideoLikesBarTooltipText () {
- this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes`
- }
-
private handleError (err: any) {
const errorMessage: string = typeof err === 'string' ? err : err.message
if (!errorMessage) return
this.buildPlayer(urlOptions)
.catch(err => console.error('Cannot build the player', err))
- this.setVideoLikesBarTooltipText()
-
this.setOpenGraphTags()
const hookOptions = {