]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video.service.ts
Add concept of video state, and add ability to wait transcoding before
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video.service.ts
index 58cb52efcbc6a8239b8afe9437a565c094610cfd..d63915ad238b06f851ae88917f727eaaa21e3e6e 100644 (file)
@@ -80,6 +80,7 @@ export class VideoService {
       privacy: video.privacy,
       tags: video.tags,
       nsfw: video.nsfw,
+      waitTranscoding: video.waitTranscoding,
       commentsEnabled: video.commentsEnabled,
       thumbnailfile: video.thumbnailfile,
       previewfile: video.previewfile
@@ -98,11 +99,11 @@ export class VideoService {
     const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true })
 
     return this.authHttp
-               .request<{ video: { id: number, uuid: string} }>(req)
+               .request<{ video: { id: number, uuid: string } }>(req)
                .pipe(catchError(this.restExtractor.handleError))
   }
 
-  getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number}> {
+  getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -120,7 +121,7 @@ export class VideoService {
     account: Account,
     videoPagination: ComponentPagination,
     sort: VideoSortField
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -138,7 +139,7 @@ export class VideoService {
     videoChannel: VideoChannel,
     videoPagination: ComponentPagination,
     sort: VideoSortField
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -156,7 +157,7 @@ export class VideoService {
     videoPagination: ComponentPagination,
     sort: VideoSortField,
     filter?: VideoFilter
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -225,7 +226,7 @@ export class VideoService {
     search: string,
     videoPagination: ComponentPagination,
     sort: VideoSortField
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const url = VideoService.BASE_VIDEO_URL + 'search'
 
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
@@ -295,18 +296,18 @@ export class VideoService {
 
   private extractVideos (result: ResultList<VideoServerModel>) {
     return this.serverService.localeObservable
-      .pipe(
-        map(translations => {
-          const videosJson = result.data
-          const totalVideos = result.total
-          const videos: Video[] = []
-
-          for (const videoJson of videosJson) {
-            videos.push(new Video(videoJson, translations))
-          }
-
-          return { videos, totalVideos }
-        })
-      )
+               .pipe(
+                 map(translations => {
+                   const videosJson = result.data
+                   const totalVideos = result.total
+                   const videos: Video[] = []
+
+                   for (const videoJson of videosJson) {
+                     videos.push(new Video(videoJson, translations))
+                   }
+
+                   return { videos, totalVideos }
+                 })
+               )
   }
 }