]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video/video.service.ts
Add ability to run transcoding jobs
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / video.service.ts
index d135a27dc8ded93d0f525539a328fc004076d420..9bfa397f8979e0d547af7753ba275eac9fcdb4ca 100644 (file)
@@ -21,6 +21,7 @@ import {
   VideoInclude,
   VideoPrivacy,
   VideoSortField,
+  VideoTranscodingCreate,
   VideoUpdate
 } from '@shared/models'
 import { environment } from '../../../../environments/environment'
@@ -308,6 +309,17 @@ export class VideoService {
       )
   }
 
+  runTranscoding (videoIds: (number | string)[], type: 'hls' | 'webtorrent') {
+    const body: VideoTranscodingCreate = { transcodingType: type }
+
+    return from(videoIds)
+      .pipe(
+        concatMap(id => this.authHttp.post(VideoService.BASE_VIDEO_URL + '/' + id + '/transcoding', body)),
+        toArray(),
+        catchError(err => this.restExtractor.handleError(err))
+      )
+  }
+
   loadCompleteDescription (descriptionPath: string) {
     return this.authHttp
                .get<{ description: string }>(environment.apiUrl + descriptionPath)