X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-video-live%2Flive-stream-information.component.ts;h=1cf6f852844d0388da7dcc1e28be513bb2c3ac2c;hb=64324ac646b0938e35cd88771492623b640bd0d8;hp=9a5d2809bd0c6be2097c594067abec47d2f3f51f;hpb=312644ce3a59fcc10cc08d422081ebacfa14eec7;p=github%2FChocobozzz%2FPeerTube.git 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 @@ import { Component, ElementRef, ViewChild } from '@angular/core' import { Video } from '@app/shared/shared-main' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { LiveVideo } from '@shared/models' +import { LiveVideo, LiveVideoError, LiveVideoSession } from '@shared/models' import { LiveVideoService } from './live-video.service' @Component({ @@ -14,6 +14,7 @@ export class LiveStreamInformationComponent { video: Video live: LiveVideo + latestLiveSessions: LiveVideoSession[] = [] constructor ( private modalService: NgbModal, @@ -30,8 +31,29 @@ export class LiveStreamInformationComponent { .open(this.modal, { centered: true }) } + getVideoUrl (video: { shortUUID: string }) { + return Video.buildWatchUrl(video) + } + + getErrorLabel (session: LiveVideoSession) { + if (!session.error) return undefined + + const errors: { [ id in LiveVideoError ]: string } = { + [LiveVideoError.BAD_SOCKET_HEALTH]: $localize`Server too slow`, + [LiveVideoError.BLACKLISTED]: $localize`Live blacklisted`, + [LiveVideoError.DURATION_EXCEEDED]: $localize`Max duration exceeded`, + [LiveVideoError.FFMPEG_ERROR]: $localize`Server error`, + [LiveVideoError.QUOTA_EXCEEDED]: $localize`Quota exceeded` + } + + return errors[session.error] + } + private loadLiveInfo (video: Video) { this.liveVideoService.getVideoLive(video.id) .subscribe(live => this.live = live) + + this.liveVideoService.listSessions(video.id) + .subscribe(({ data }) => this.latestLiveSessions = data.slice(0, 5)) } }