import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor } from '@app/core'
-import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult } 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 {
.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)