From f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 5 Nov 2020 10:56:23 +0100 Subject: Add live info in watch page --- .../shared-video-miniature.module.ts | 4 +++- .../video-actions-dropdown.component.html | 1 + .../video-actions-dropdown.component.ts | 22 +++++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/shared-video-miniature') diff --git a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts index 666144864..08c8da3dd 100644 --- a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts +++ b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts @@ -5,6 +5,7 @@ import { SharedGlobalIconModule } from '../shared-icons' import { SharedMainModule } from '../shared-main/shared-main.module' import { SharedModerationModule } from '../shared-moderation' import { SharedThumbnailModule } from '../shared-thumbnail' +import { SharedVideoLiveModule } from '../shared-video-live' import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module' import { VideoActionsDropdownComponent } from './video-actions-dropdown.component' import { VideoDownloadComponent } from './video-download.component' @@ -18,7 +19,8 @@ import { VideosSelectionComponent } from './videos-selection.component' SharedModerationModule, SharedVideoPlaylistModule, SharedThumbnailModule, - SharedGlobalIconModule + SharedGlobalIconModule, + SharedVideoLiveModule ], declarations: [ diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html index 3c8271b65..00ee196ac 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html @@ -18,4 +18,5 @@ + diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 8f4c129a5..18b4a2f3c 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts @@ -13,6 +13,7 @@ import { VideoDetails, VideoService } from '../shared-main' +import { LiveStreamInformationComponent } from '../shared-video-live' import { VideoAddToPlaylistComponent } from '../shared-video-playlist' import { VideoDownloadComponent } from './video-download.component' @@ -25,6 +26,7 @@ export type VideoActionsDisplayType = { report?: boolean duplicate?: boolean mute?: boolean + liveInfo?: boolean } @Component({ @@ -39,6 +41,7 @@ export class VideoActionsDropdownComponent implements OnChanges { @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent @ViewChild('videoReportModal') videoReportModal: VideoReportComponent @ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent + @ViewChild('liveStreamInformationModal') liveStreamInformationModal: LiveStreamInformationComponent @Input() video: Video | VideoDetails @Input() videoCaptions: VideoCaption[] = [] @@ -51,7 +54,8 @@ export class VideoActionsDropdownComponent implements OnChanges { delete: true, report: true, duplicate: true, - mute: true + mute: true, + liveInfo: false } @Input() placement = 'left' @@ -127,6 +131,12 @@ export class VideoActionsDropdownComponent implements OnChanges { this.videoBlockModal.show() } + showLiveInfoModal (video: Video) { + this.modalOpened.emit() + + this.liveStreamInformationModal.show(video) + } + /* Actions checker */ isVideoUpdatable () { @@ -145,6 +155,10 @@ export class VideoActionsDropdownComponent implements OnChanges { return this.video.isUnblockableBy(this.user) } + isVideoLiveInfoAvailable () { + return this.video.isLiveInfoAvailableBy(this.user) + } + isVideoDownloadable () { return this.video && this.video.isLive !== true && @@ -260,6 +274,12 @@ export class VideoActionsDropdownComponent implements OnChanges { isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(), iconName: 'download' }, + { + label: $localize`Display live information`, + handler: ({ video }) => this.showLiveInfoModal(video), + isDisplayed: () => this.isVideoLiveInfoAvailable(), + iconName: 'live' + }, { label: $localize`Update`, linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], -- cgit v1.2.3