diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-12 20:04:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-12 20:37:51 +0200 |
commit | 2186386cca113506791583cb07d6ccacba7af4e0 (patch) | |
tree | 3c214c0b5fbd64332624267fa6e51fd4a9cf6474 /client/src/app/shared/video/video.service.ts | |
parent | 6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf (diff) | |
download | PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.gz PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.zst PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.zip |
Add concept of video state, and add ability to wait transcoding before
publishing a video
Diffstat (limited to 'client/src/app/shared/video/video.service.ts')
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 58cb52efc..d63915ad2 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -80,6 +80,7 @@ export class VideoService { | |||
80 | privacy: video.privacy, | 80 | privacy: video.privacy, |
81 | tags: video.tags, | 81 | tags: video.tags, |
82 | nsfw: video.nsfw, | 82 | nsfw: video.nsfw, |
83 | waitTranscoding: video.waitTranscoding, | ||
83 | commentsEnabled: video.commentsEnabled, | 84 | commentsEnabled: video.commentsEnabled, |
84 | thumbnailfile: video.thumbnailfile, | 85 | thumbnailfile: video.thumbnailfile, |
85 | previewfile: video.previewfile | 86 | previewfile: video.previewfile |
@@ -98,11 +99,11 @@ export class VideoService { | |||
98 | const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true }) | 99 | const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true }) |
99 | 100 | ||
100 | return this.authHttp | 101 | return this.authHttp |
101 | .request<{ video: { id: number, uuid: string} }>(req) | 102 | .request<{ video: { id: number, uuid: string } }>(req) |
102 | .pipe(catchError(this.restExtractor.handleError)) | 103 | .pipe(catchError(this.restExtractor.handleError)) |
103 | } | 104 | } |
104 | 105 | ||
105 | getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number}> { | 106 | getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number }> { |
106 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 107 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
107 | 108 | ||
108 | let params = new HttpParams() | 109 | let params = new HttpParams() |
@@ -120,7 +121,7 @@ export class VideoService { | |||
120 | account: Account, | 121 | account: Account, |
121 | videoPagination: ComponentPagination, | 122 | videoPagination: ComponentPagination, |
122 | sort: VideoSortField | 123 | sort: VideoSortField |
123 | ): Observable<{ videos: Video[], totalVideos: number}> { | 124 | ): Observable<{ videos: Video[], totalVideos: number }> { |
124 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 125 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
125 | 126 | ||
126 | let params = new HttpParams() | 127 | let params = new HttpParams() |
@@ -138,7 +139,7 @@ export class VideoService { | |||
138 | videoChannel: VideoChannel, | 139 | videoChannel: VideoChannel, |
139 | videoPagination: ComponentPagination, | 140 | videoPagination: ComponentPagination, |
140 | sort: VideoSortField | 141 | sort: VideoSortField |
141 | ): Observable<{ videos: Video[], totalVideos: number}> { | 142 | ): Observable<{ videos: Video[], totalVideos: number }> { |
142 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 143 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
143 | 144 | ||
144 | let params = new HttpParams() | 145 | let params = new HttpParams() |
@@ -156,7 +157,7 @@ export class VideoService { | |||
156 | videoPagination: ComponentPagination, | 157 | videoPagination: ComponentPagination, |
157 | sort: VideoSortField, | 158 | sort: VideoSortField, |
158 | filter?: VideoFilter | 159 | filter?: VideoFilter |
159 | ): Observable<{ videos: Video[], totalVideos: number}> { | 160 | ): Observable<{ videos: Video[], totalVideos: number }> { |
160 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 161 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
161 | 162 | ||
162 | let params = new HttpParams() | 163 | let params = new HttpParams() |
@@ -225,7 +226,7 @@ export class VideoService { | |||
225 | search: string, | 226 | search: string, |
226 | videoPagination: ComponentPagination, | 227 | videoPagination: ComponentPagination, |
227 | sort: VideoSortField | 228 | sort: VideoSortField |
228 | ): Observable<{ videos: Video[], totalVideos: number}> { | 229 | ): Observable<{ videos: Video[], totalVideos: number }> { |
229 | const url = VideoService.BASE_VIDEO_URL + 'search' | 230 | const url = VideoService.BASE_VIDEO_URL + 'search' |
230 | 231 | ||
231 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 232 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
@@ -295,18 +296,18 @@ export class VideoService { | |||
295 | 296 | ||
296 | private extractVideos (result: ResultList<VideoServerModel>) { | 297 | private extractVideos (result: ResultList<VideoServerModel>) { |
297 | return this.serverService.localeObservable | 298 | return this.serverService.localeObservable |
298 | .pipe( | 299 | .pipe( |
299 | map(translations => { | 300 | map(translations => { |
300 | const videosJson = result.data | 301 | const videosJson = result.data |
301 | const totalVideos = result.total | 302 | const totalVideos = result.total |
302 | const videos: Video[] = [] | 303 | const videos: Video[] = [] |
303 | 304 | ||
304 | for (const videoJson of videosJson) { | 305 | for (const videoJson of videosJson) { |
305 | videos.push(new Video(videoJson, translations)) | 306 | videos.push(new Video(videoJson, translations)) |
306 | } | 307 | } |
307 | 308 | ||
308 | return { videos, totalVideos } | 309 | return { videos, totalVideos } |
309 | }) | 310 | }) |
310 | ) | 311 | ) |
311 | } | 312 | } |
312 | } | 313 | } |