]>
Commit | Line | Data |
---|---|---|
d846d99c | 1 | import { Component, ElementRef, ViewChild } from '@angular/core' |
f8c00564 | 2 | import { Video } from '@app/shared/shared-main' |
d846d99c | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
f8c00564 | 4 | import { LiveVideoService } from './live-video.service' |
d846d99c C |
5 | |
6 | @Component({ | |
7 | selector: 'my-live-stream-information', | |
8 | templateUrl: './live-stream-information.component.html', | |
9 | styleUrls: [ './live-stream-information.component.scss' ] | |
10 | }) | |
11 | export class LiveStreamInformationComponent { | |
12 | @ViewChild('modal', { static: true }) modal: ElementRef | |
13 | ||
14 | video: Video | |
15 | rtmpUrl = '' | |
16 | streamKey = '' | |
17 | ||
18 | constructor ( | |
19 | private modalService: NgbModal, | |
20 | private liveVideoService: LiveVideoService | |
21 | ) { } | |
22 | ||
23 | show (video: Video) { | |
24 | this.video = video | |
25 | this.rtmpUrl = '' | |
26 | this.streamKey = '' | |
27 | ||
28 | this.loadLiveInfo(video) | |
29 | ||
30 | this.modalService | |
31 | .open(this.modal, { centered: true }) | |
32 | } | |
33 | ||
34 | private loadLiveInfo (video: Video) { | |
35 | this.liveVideoService.getVideoLive(video.id) | |
36 | .subscribe(live => { | |
37 | this.rtmpUrl = live.rtmpUrl | |
38 | this.streamKey = live.streamKey | |
39 | }) | |
40 | } | |
41 | } |