diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-05 10:56:23 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c (patch) | |
tree | 895792776837b477d4daff3d1c112942015d0371 /client/src/app/shared/shared-video-live/live-stream-information.component.ts | |
parent | ba881f0e3f60218b28abbb59d23118db5f97d5f8 (diff) | |
download | PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.tar.gz PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.tar.zst PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.zip |
Add live info in watch page
Diffstat (limited to 'client/src/app/shared/shared-video-live/live-stream-information.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-live/live-stream-information.component.ts | 41 |
1 files changed, 41 insertions, 0 deletions
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 @@ | |||
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 { LiveVideoService } from './live-video.service' | ||
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 | } | ||