VideoPrivacy,
VideoScheduleUpdate,
VideoState,
- VideoStreamingPlaylist
+ VideoStreamingPlaylist,
+ VideoStreamingPlaylistType
} from '@shared/models'
export class Video implements VideoServerModel {
return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
}
+ canRemoveFiles (user: AuthUser) {
+ return this.isLocal &&
+ user.hasRight(UserRight.MANAGE_VIDEO_FILES) &&
+ this.state.id !== VideoState.TO_TRANSCODE &&
+ this.hasHLS() &&
+ this.hasWebTorrent()
+ }
+
+ canRunTranscoding (user: AuthUser) {
+ return this.isLocal &&
+ user.hasRight(UserRight.RUN_VIDEO_TRANSCODING) &&
+ this.state.id !== VideoState.TO_TRANSCODE
+ }
+
+ hasHLS () {
+ return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS)
+ }
+
+ hasWebTorrent () {
+ return this.files && this.files.length !== 0
+ }
+
isLiveInfoAvailableBy (user: AuthUser) {
return this.isLive &&
user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE))