aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/video/video-live.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-17 09:20:52 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitc6c0fa6cd8fe8f752463d8982c3dbcd448739c4e (patch)
tree79304b0152b0a38d33b26e65d4acdad0da4032a7 /client/src/app/shared/shared-main/video/video-live.service.ts
parent110d463fece85e87a26aca48a6048ae0017a27b3 (diff)
downloadPeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.gz
PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.zst
PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.zip
Live streaming implementation first step
Diffstat (limited to 'client/src/app/shared/shared-main/video/video-live.service.ts')
-rw-r--r--client/src/app/shared/shared-main/video/video-live.service.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-main/video/video-live.service.ts b/client/src/app/shared/shared-main/video/video-live.service.ts
new file mode 100644
index 000000000..12daff756
--- /dev/null
+++ b/client/src/app/shared/shared-main/video/video-live.service.ts
@@ -0,0 +1,28 @@
1import { catchError } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core'
4import { RestExtractor } from '@app/core'
5import { VideoCreate, VideoLive } from '@shared/models'
6import { environment } from '../../../../environments/environment'
7
8@Injectable()
9export class VideoLiveService {
10 static BASE_VIDEO_LIVE_URL = environment.apiUrl + '/api/v1/videos/live/'
11
12 constructor (
13 private authHttp: HttpClient,
14 private restExtractor: RestExtractor
15 ) {}
16
17 goLive (video: VideoCreate) {
18 return this.authHttp
19 .post<{ video: { id: number, uuid: string } }>(VideoLiveService.BASE_VIDEO_LIVE_URL, video)
20 .pipe(catchError(err => this.restExtractor.handleError(err)))
21 }
22
23 getVideoLive (videoId: number | string) {
24 return this.authHttp
25 .get<VideoLive>(VideoLiveService.BASE_VIDEO_LIVE_URL + videoId)
26 .pipe(catchError(err => this.restExtractor.handleError(err)))
27 }
28}