aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-video-live/live-video.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-05 10:56:23 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitf8c00564e7e66c7c9d65ea044a4c1485df0e4c7c (patch)
tree895792776837b477d4daff3d1c112942015d0371 /client/src/app/shared/shared-video-live/live-video.service.ts
parentba881f0e3f60218b28abbb59d23118db5f97d5f8 (diff)
downloadPeerTube-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-video.service.ts')
-rw-r--r--client/src/app/shared/shared-video-live/live-video.service.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-video-live/live-video.service.ts b/client/src/app/shared/shared-video-live/live-video.service.ts
new file mode 100644
index 000000000..b02442eae
--- /dev/null
+++ b/client/src/app/shared/shared-video-live/live-video.service.ts
@@ -0,0 +1,34 @@
1import { catchError } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core'
4import { RestExtractor } from '@app/core'
5import { LiveVideo, LiveVideoCreate, LiveVideoUpdate } from '@shared/models'
6import { environment } from '../../../environments/environment'
7
8@Injectable()
9export class LiveVideoService {
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: LiveVideoCreate) {
18 return this.authHttp
19 .post<{ video: { id: number, uuid: string } }>(LiveVideoService.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<LiveVideo>(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId)
26 .pipe(catchError(err => this.restExtractor.handleError(err)))
27 }
28
29 updateLive (videoId: number | string, liveUpdate: LiveVideoUpdate) {
30 return this.authHttp
31 .put(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId, liveUpdate)
32 .pipe(catchError(err => this.restExtractor.handleError(err)))
33 }
34}