From d846d99c6c81028bb7bd3cb20abd433cbf396a22 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Oct 2020 10:49:20 +0100 Subject: [PATCH] Add modal to display live information --- .../live-stream-information.component.html | 33 +++++++++++++++ .../live-stream-information.component.scss} | 0 .../live-stream-information.component.ts | 40 +++++++++++++++++++ .../video-change-ownership.component.html | 2 +- .../video-change-ownership.component.scss | 10 +++++ .../video-change-ownership.component.ts | 0 .../my-account-videos.component.html | 9 +---- .../my-account-videos.component.ts | 38 ++++++++++++++++-- .../src/app/+my-account/my-account.module.ts | 5 ++- .../+video-watch/video-watch.component.ts | 2 +- .../shared-icons/global-icon.component.ts | 1 + .../video-block.component.html | 7 +++- .../video-block.component.scss | 5 +++ .../video-actions-dropdown.component.ts | 7 +++- client/src/assets/images/feather/live.svg | 1 + .../job-queue/handlers/video-live-ending.ts | 12 +++++- .../job-queue/handlers/video-transcoding.ts | 23 +---------- server/lib/video.ts | 28 ++++++++++++- 18 files changed, 183 insertions(+), 40 deletions(-) create mode 100644 client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.html rename client/src/app/+my-account/my-account-videos/{video-change-ownership/video-change-ownership.component.scss => modals/live-stream-information.component.scss} (100%) create mode 100644 client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.ts rename client/src/app/+my-account/my-account-videos/{video-change-ownership => modals}/video-change-ownership.component.html (96%) create mode 100644 client/src/app/+my-account/my-account-videos/modals/video-change-ownership.component.scss rename client/src/app/+my-account/my-account-videos/{video-change-ownership => modals}/video-change-ownership.component.ts (100%) create mode 100644 client/src/assets/images/feather/live.svg diff --git a/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.html b/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.html new file mode 100644 index 000000000..5e2323b91 --- /dev/null +++ b/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.html @@ -0,0 +1,33 @@ + + + + + + + diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.scss b/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.scss similarity index 100% rename from client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.scss rename to client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.scss diff --git a/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.ts b/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.ts new file mode 100644 index 000000000..a5885a8e7 --- /dev/null +++ b/client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.ts @@ -0,0 +1,40 @@ +import { Component, ElementRef, ViewChild } from '@angular/core' +import { LiveVideoService, Video } from '@app/shared/shared-main' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' + +@Component({ + selector: 'my-live-stream-information', + templateUrl: './live-stream-information.component.html', + styleUrls: [ './live-stream-information.component.scss' ] +}) +export class LiveStreamInformationComponent { + @ViewChild('modal', { static: true }) modal: ElementRef + + video: Video + rtmpUrl = '' + streamKey = '' + + constructor ( + private modalService: NgbModal, + private liveVideoService: LiveVideoService + ) { } + + show (video: Video) { + this.video = video + this.rtmpUrl = '' + this.streamKey = '' + + this.loadLiveInfo(video) + + this.modalService + .open(this.modal, { centered: true }) + } + + private loadLiveInfo (video: Video) { + this.liveVideoService.getVideoLive(video.id) + .subscribe(live => { + this.rtmpUrl = live.rtmpUrl + this.streamKey = live.streamKey + }) + } +} diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.html b/client/src/app/+my-account/my-account-videos/modals/video-change-ownership.component.html similarity index 96% rename from client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.html rename to client/src/app/+my-account/my-account-videos/modals/video-change-ownership.component.html index 9d809d2bf..c7c5a0b69 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.html +++ b/client/src/app/+my-account/my-account-videos/modals/video-change-ownership.component.html @@ -16,7 +16,7 @@ -