VideoDetails,
VideoService
} from '../shared-main'
+import { LiveStreamInformationComponent } from '../shared-video-live'
import { VideoAddToPlaylistComponent } from '../shared-video-playlist'
import { VideoDownloadComponent } from './video-download.component'
report?: boolean
duplicate?: boolean
mute?: boolean
+ liveInfo?: boolean
}
@Component({
@ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
@ViewChild('videoReportModal') videoReportModal: VideoReportComponent
@ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent
+ @ViewChild('liveStreamInformationModal') liveStreamInformationModal: LiveStreamInformationComponent
@Input() video: Video | VideoDetails
@Input() videoCaptions: VideoCaption[] = []
delete: true,
report: true,
duplicate: true,
- mute: true
+ mute: true,
+ liveInfo: false
}
@Input() placement = 'left'
ngOnChanges () {
if (this.loaded) {
this.loaded = false
- this.playlistAdd.reload()
+ if (this.playlistAdd) this.playlistAdd.reload()
}
this.buildActions()
this.videoBlockModal.show()
}
+ showLiveInfoModal (video: Video) {
+ this.modalOpened.emit()
+
+ this.liveStreamInformationModal.show(video)
+ }
+
/* Actions checker */
isVideoUpdatable () {
return this.video.isUnblockableBy(this.user)
}
+ isVideoLiveInfoAvailable () {
+ return this.video.isLiveInfoAvailableBy(this.user)
+ }
+
isVideoDownloadable () {
- return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled
+ return this.video &&
+ this.video.isLive !== true &&
+ this.video instanceof VideoDetails &&
+ this.video.downloadEnabled
}
canVideoBeDuplicated () {
async removeVideo () {
this.modalOpened.emit()
- const res = await this.confirmService.confirm($localize`Do you really want to delete this video?`, $localize`Delete`)
+ let message = $localize`Do you really want to delete this video?`
+ if (this.video.isLive) {
+ message += ' ' + $localize`The live stream will be automatically terminated.`
+ }
+
+ const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return
this.videoService.removeVideo(this.video.id)
isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(),
iconName: 'download'
},
+ {
+ label: $localize`Display live information`,
+ handler: ({ video }) => this.showLiveInfoModal(video),
+ isDisplayed: () => this.displayOptions.liveInfo && this.isVideoLiveInfoAvailable(),
+ iconName: 'live'
+ },
{
label: $localize`Update`,
linkBuilder: ({ video }) => [ '/videos/update', video.uuid ],