From a5cf76afa378aae81af2a9b0ce548e5d2582f832 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Sep 2020 10:04:21 +0200 Subject: Add watch messages if live has not started --- .../shared/shared-main/video/live-video.service.ts | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 client/src/app/shared/shared-main/video/live-video.service.ts (limited to 'client/src/app/shared/shared-main/video/live-video.service.ts') diff --git a/client/src/app/shared/shared-main/video/live-video.service.ts b/client/src/app/shared/shared-main/video/live-video.service.ts new file mode 100644 index 000000000..2cd1c66a5 --- /dev/null +++ b/client/src/app/shared/shared-main/video/live-video.service.ts @@ -0,0 +1,28 @@ +import { catchError } from 'rxjs/operators' +import { HttpClient } from '@angular/common/http' +import { Injectable } from '@angular/core' +import { RestExtractor } from '@app/core' +import { VideoCreate, LiveVideo } from '@shared/models' +import { environment } from '../../../../environments/environment' + +@Injectable() +export class LiveVideoService { + static BASE_VIDEO_LIVE_URL = environment.apiUrl + '/api/v1/videos/live/' + + constructor ( + private authHttp: HttpClient, + private restExtractor: RestExtractor + ) {} + + goLive (video: VideoCreate) { + return this.authHttp + .post<{ video: { id: number, uuid: string } }>(LiveVideoService.BASE_VIDEO_LIVE_URL, video) + .pipe(catchError(err => this.restExtractor.handleError(err))) + } + + getVideoLive (videoId: number | string) { + return this.authHttp + .get(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId) + .pipe(catchError(err => this.restExtractor.handleError(err))) + } +} -- cgit v1.2.3