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