+ isBlacklisted () {
+ return !!this.VideoBlacklist
+ }
+
+ isBlocked () {
+ return (this.VideoChannel.Account.Actor.Server && this.VideoChannel.Account.Actor.Server.isBlocked()) ||
+ this.VideoChannel.Account.isBlocked()
+ }
+
+ getQualityFileBy <T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) {
+ if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) {
+ const file = fun(this.VideoFiles, file => file.resolution)
+
+ return Object.assign(file, { Video: this })
+ }
+
+ // No webtorrent files, try with streaming playlist files
+ if (Array.isArray(this.VideoStreamingPlaylists) && this.VideoStreamingPlaylists.length !== 0) {
+ const streamingPlaylistWithVideo = Object.assign(this.VideoStreamingPlaylists[0], { Video: this })
+
+ const file = fun(streamingPlaylistWithVideo.VideoFiles, file => file.resolution)
+ return Object.assign(file, { VideoStreamingPlaylist: streamingPlaylistWithVideo })
+ }
+
+ return undefined
+ }
+
+ getMaxQualityFile <T extends MVideoWithFile> (this: T): MVideoFileVideo | MVideoFileStreamingPlaylistVideo {
+ return this.getQualityFileBy(maxBy)
+ }
+
+ getMinQualityFile <T extends MVideoWithFile> (this: T): MVideoFileVideo | MVideoFileStreamingPlaylistVideo {
+ return this.getQualityFileBy(minBy)
+ }
+
+ getWebTorrentFile <T extends MVideoWithFile> (this: T, resolution: number): MVideoFileVideo {