diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-03 15:11:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-03 15:21:42 +0200 |
commit | 39e68a3254242bd410ffc20b7f74b442a07b390f (patch) | |
tree | 3ad74189343796d52c8fd5c1825ac648dff15ea1 /client/src/app/shared/shared-video-live/live-stream-information.component.ts | |
parent | 26e3e98ff0e222a9fb9226938ac6902af77921bd (diff) | |
download | PeerTube-39e68a3254242bd410ffc20b7f74b442a07b390f.tar.gz PeerTube-39e68a3254242bd410ffc20b7f74b442a07b390f.tar.zst PeerTube-39e68a3254242bd410ffc20b7f74b442a07b390f.zip |
Add session informations in live modal
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 | 24 |
1 files changed, 23 insertions, 1 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 index 9a5d2809b..1cf6f8528 100644 --- 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 | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, ElementRef, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, ViewChild } from '@angular/core' |
2 | import { Video } from '@app/shared/shared-main' | 2 | import { Video } from '@app/shared/shared-main' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { LiveVideo } from '@shared/models' | 4 | import { LiveVideo, LiveVideoError, LiveVideoSession } from '@shared/models' |
5 | import { LiveVideoService } from './live-video.service' | 5 | import { LiveVideoService } from './live-video.service' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
@@ -14,6 +14,7 @@ export class LiveStreamInformationComponent { | |||
14 | 14 | ||
15 | video: Video | 15 | video: Video |
16 | live: LiveVideo | 16 | live: LiveVideo |
17 | latestLiveSessions: LiveVideoSession[] = [] | ||
17 | 18 | ||
18 | constructor ( | 19 | constructor ( |
19 | private modalService: NgbModal, | 20 | private modalService: NgbModal, |
@@ -30,8 +31,29 @@ export class LiveStreamInformationComponent { | |||
30 | .open(this.modal, { centered: true }) | 31 | .open(this.modal, { centered: true }) |
31 | } | 32 | } |
32 | 33 | ||
34 | getVideoUrl (video: { shortUUID: string }) { | ||
35 | return Video.buildWatchUrl(video) | ||
36 | } | ||
37 | |||
38 | getErrorLabel (session: LiveVideoSession) { | ||
39 | if (!session.error) return undefined | ||
40 | |||
41 | const errors: { [ id in LiveVideoError ]: string } = { | ||
42 | [LiveVideoError.BAD_SOCKET_HEALTH]: $localize`Server too slow`, | ||
43 | [LiveVideoError.BLACKLISTED]: $localize`Live blacklisted`, | ||
44 | [LiveVideoError.DURATION_EXCEEDED]: $localize`Max duration exceeded`, | ||
45 | [LiveVideoError.FFMPEG_ERROR]: $localize`Server error`, | ||
46 | [LiveVideoError.QUOTA_EXCEEDED]: $localize`Quota exceeded` | ||
47 | } | ||
48 | |||
49 | return errors[session.error] | ||
50 | } | ||
51 | |||
33 | private loadLiveInfo (video: Video) { | 52 | private loadLiveInfo (video: Video) { |
34 | this.liveVideoService.getVideoLive(video.id) | 53 | this.liveVideoService.getVideoLive(video.id) |
35 | .subscribe(live => this.live = live) | 54 | .subscribe(live => this.live = live) |
55 | |||
56 | this.liveVideoService.listSessions(video.id) | ||
57 | .subscribe(({ data }) => this.latestLiveSessions = data.slice(0, 5)) | ||
36 | } | 58 | } |
37 | } | 59 | } |