]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-video-live/live-video.service.ts
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-video-live / live-video.service.ts
index b02442eae2df984b1516e3ccf931ea88e64bded6..89bfd84a0130bf79a805222330af4b8ed1f70a80 100644 (file)
@@ -2,8 +2,9 @@ import { catchError } from 'rxjs/operators'
 import { HttpClient } from '@angular/common/http'
 import { Injectable } from '@angular/core'
 import { RestExtractor } from '@app/core'
-import { LiveVideo, LiveVideoCreate, LiveVideoUpdate } from '@shared/models'
+import { LiveVideo, LiveVideoCreate, LiveVideoSession, LiveVideoUpdate, ResultList, VideoCreateResult } from '@shared/models'
 import { environment } from '../../../environments/environment'
+import { VideoService } from '../shared-main'
 
 @Injectable()
 export class LiveVideoService {
@@ -16,7 +17,7 @@ export class LiveVideoService {
 
   goLive (video: LiveVideoCreate) {
     return this.authHttp
-               .post<{ video: { id: number, uuid: string } }>(LiveVideoService.BASE_VIDEO_LIVE_URL, video)
+               .post<{ video: VideoCreateResult }>(LiveVideoService.BASE_VIDEO_LIVE_URL, video)
                .pipe(catchError(err => this.restExtractor.handleError(err)))
   }
 
@@ -26,6 +27,18 @@ export class LiveVideoService {
                .pipe(catchError(err => this.restExtractor.handleError(err)))
   }
 
+  listSessions (videoId: number | string) {
+    return this.authHttp
+               .get<ResultList<LiveVideoSession>>(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId + '/sessions')
+               .pipe(catchError(err => this.restExtractor.handleError(err)))
+  }
+
+  findLiveSessionFromVOD (videoId: number | string) {
+    return this.authHttp
+               .get<LiveVideoSession>(VideoService.BASE_VIDEO_URL + '/' + videoId + '/live-session')
+               .pipe(catchError(err => this.restExtractor.handleError(err)))
+  }
+
   updateLive (videoId: number | string, liveUpdate: LiveVideoUpdate) {
     return this.authHttp
       .put(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId, liveUpdate)