]>
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' |
312644ce | 4 | import { LiveVideo } from '@shared/models' |
f8c00564 | 5 | import { LiveVideoService } from './live-video.service' |
d846d99c C |
6 | |
7 | @Component({ | |
8 | selector: 'my-live-stream-information', | |
9 | templateUrl: './live-stream-information.component.html', | |
10 | styleUrls: [ './live-stream-information.component.scss' ] | |
11 | }) | |
12 | export class LiveStreamInformationComponent { | |
13 | @ViewChild('modal', { static: true }) modal: ElementRef | |
14 | ||
15 | video: Video | |
312644ce | 16 | live: LiveVideo |
d846d99c C |
17 | |
18 | constructor ( | |
19 | private modalService: NgbModal, | |
20 | private liveVideoService: LiveVideoService | |
21 | ) { } | |
22 | ||
23 | show (video: Video) { | |
24 | this.video = video | |
312644ce | 25 | this.live = undefined |
d846d99c C |
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) | |
312644ce | 35 | .subscribe(live => this.live = live) |
d846d99c C |
36 | } |
37 | } |