]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-video-live/live-stream-information.component.ts
Add badge for permanent live in live info modal
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-video-live / live-stream-information.component.ts
1 import { Component, ElementRef, ViewChild } from '@angular/core'
2 import { Video } from '@app/shared/shared-main'
3 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4 import { LiveVideo } from '@shared/models'
5 import { LiveVideoService } from './live-video.service'
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
16 live: LiveVideo
17
18 constructor (
19 private modalService: NgbModal,
20 private liveVideoService: LiveVideoService
21 ) { }
22
23 show (video: Video) {
24 this.video = video
25 this.live = undefined
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 => this.live = live)
36 }
37 }