aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/video/video.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main/video/video.service.ts')
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index 142367506..83bc4eeb6 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -1,5 +1,5 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { from, Observable } from 'rxjs' 2import { from, Observable, of } from 'rxjs'
3import { catchError, concatMap, map, switchMap, toArray } from 'rxjs/operators' 3import { catchError, concatMap, map, switchMap, toArray } from 'rxjs/operators'
4import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http' 4import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
@@ -24,6 +24,7 @@ import {
24 VideoTranscodingCreate, 24 VideoTranscodingCreate,
25 VideoUpdate 25 VideoUpdate
26} from '@shared/models' 26} from '@shared/models'
27import { VideoSource } from '@shared/models/videos/video-source'
27import { environment } from '../../../../environments/environment' 28import { environment } from '../../../../environments/environment'
28import { Account } from '../account/account.model' 29import { Account } from '../account/account.model'
29import { AccountService } from '../account/account.service' 30import { AccountService } from '../account/account.service'
@@ -323,6 +324,20 @@ export class VideoService {
323 ) 324 )
324 } 325 }
325 326
327 getSource (videoId: number) {
328 return this.authHttp
329 .get<{ source: VideoSource }>(VideoService.BASE_VIDEO_URL + '/' + videoId + '/source')
330 .pipe(
331 catchError(err => {
332 if (err.status === 404) {
333 return of(undefined)
334 }
335
336 this.restExtractor.handleError(err)
337 })
338 )
339 }
340
326 setVideoLike (id: number) { 341 setVideoLike (id: number) {
327 return this.setVideoRate(id, 'like') 342 return this.setVideoRate(id, 'like')
328 } 343 }