From d846d99c6c81028bb7bd3cb20abd433cbf396a22 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Oct 2020 10:49:20 +0100 Subject: Add modal to display live information --- .../modals/live-stream-information.component.ts | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.ts (limited to 'client/src/app/+my-account/my-account-videos/modals/live-stream-information.component.ts') 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 + }) + } +} -- cgit v1.2.3