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 --- .../live-stream-information.component.ts | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 client/src/app/shared/shared-video-live/live-stream-information.component.ts (limited to 'client/src/app/shared/shared-video-live/live-stream-information.component.ts') diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.ts b/client/src/app/shared/shared-video-live/live-stream-information.component.ts new file mode 100644 index 000000000..e6142eb2e --- /dev/null +++ b/client/src/app/shared/shared-video-live/live-stream-information.component.ts @@ -0,0 +1,41 @@ +import { Component, ElementRef, ViewChild } from '@angular/core' +import { Video } from '@app/shared/shared-main' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { LiveVideoService } from './live-video.service' + +@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