import { environment } from '../../../environments/environment'
import { VideoSupportComponent } from './modal/video-support.component'
import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'
+import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
type URLOptions = CustomizationOptions & { playerMode: PlayerMode }
$localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`,
$localize`Redirection`
).then(res => {
- if (res === false) return this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ])
+ if (res === false) {
+ return this.restExtractor.redirectTo404IfNotFound(err, [
+ HttpStatusCode.BAD_REQUEST_400,
+ HttpStatusCode.UNAUTHORIZED_401,
+ HttpStatusCode.FORBIDDEN_403,
+ HttpStatusCode.NOT_FOUND_404
+ ])
+ }
return window.location.href = originUrl
})
}
- return this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ])
+ return this.restExtractor.redirectTo404IfNotFound(err, [
+ HttpStatusCode.BAD_REQUEST_400,
+ HttpStatusCode.UNAUTHORIZED_401,
+ HttpStatusCode.FORBIDDEN_403,
+ HttpStatusCode.NOT_FOUND_404
+ ])
})
)
.subscribe(([ video, captionsResult ]) => {
this.playlistService.getVideoPlaylist(playlistId)
.pipe(
// If 401, the video is private or blocked so redirect to 404
- catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
+ catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [
+ HttpStatusCode.BAD_REQUEST_400,
+ HttpStatusCode.UNAUTHORIZED_401,
+ HttpStatusCode.FORBIDDEN_403,
+ HttpStatusCode.NOT_FOUND_404
+ ]))
)
.subscribe(playlist => {
this.playlist = playlist
}
})
+ this.player.one('ended', () => {
+ if (this.video.isLive) {
+ this.video.state.id = VideoState.LIVE_ENDED
+ }
+ })
+
this.player.on('theaterChange', (_: any, enabled: boolean) => {
this.zone.run(() => this.theaterEnabled = enabled)
})
: null,
embedUrl: video.embedUrl,
+ isLive: video.isLive,
+
language: this.localeId,
userWatching: user && user.videosHistoryEnabled === true ? {
if (!this.liveVideosSub) {
this.liveVideosSub = this.peertubeSocket.getLiveVideosObservable()
.subscribe(({ payload }) => {
- if (payload.state !== VideoState.PUBLISHED || this.video.state.id !== VideoState.WAITING_FOR_LIVE) return
+ if (payload.state !== VideoState.PUBLISHED) return
+
+ const videoState = this.video.state.id
+ if (videoState !== VideoState.WAITING_FOR_LIVE && videoState !== VideoState.LIVE_ENDED) return
+
+ console.log('Loading video after live update.')
const videoUUID = this.video.uuid