-import { catchError, subscribeOn } from 'rxjs/operators'
+import { catchError } from 'rxjs/operators'
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'
new Hotkey('shift+l', (event: KeyboardEvent): boolean => {
this.setLike()
return false
- }, undefined, 'Like the video'),
+ }, undefined, this.i18n('Like the video')),
new Hotkey('shift+d', (event: KeyboardEvent): boolean => {
this.setDislike()
return false
- }, undefined, 'Dislike the video'),
+ }, undefined, this.i18n('Dislike the video')),
new Hotkey('shift+s', (event: KeyboardEvent): boolean => {
this.subscribeButton.subscribed ?
this.subscribeButton.unsubscribe() :
this.subscribeButton.subscribe()
return false
- }, undefined, 'Subscribe to the account')
+ }, undefined, this.i18n('Subscribe to the account'))
]
if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
}
)
}
- private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], startTime = 0) {
+ private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], startTimeFromUrl: number) {
this.video = video
// Re init attributes
this.completeDescriptionShown = false
this.remoteServerDown = false
+ let startTime = startTimeFromUrl || (this.video.userHistory ? this.video.userHistory.currentTime : 0)
+ // Don't start the video if we are at the end
+ if (this.video.duration - startTime <= 1) startTime = 0
+
if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) {
const res = await this.confirmService.confirm(
this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'),
poster: this.video.previewUrl,
startTime,
theaterMode: true,
- language: this.localeId
+ language: this.localeId,
+
+ userWatching: this.user ? {
+ url: this.videoService.getUserWatchingVideoUrl(this.video.uuid),
+ authorizationHeader: this.authService.getRequestHeaderValue()
+ } : undefined
})
if (this.videojsLocaleLoaded === false) {