aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/video-update.resolver.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-17 09:20:52 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitc6c0fa6cd8fe8f752463d8982c3dbcd448739c4e (patch)
tree79304b0152b0a38d33b26e65d4acdad0da4032a7 /client/src/app/+videos/+video-edit/video-update.resolver.ts
parent110d463fece85e87a26aca48a6048ae0017a27b3 (diff)
downloadPeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.gz
PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.zst
PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.zip
Live streaming implementation first step
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-update.resolver.ts')
-rw-r--r--client/src/app/+videos/+video-edit/video-update.resolver.ts61
1 files changed, 34 insertions, 27 deletions
diff --git a/client/src/app/+videos/+video-edit/video-update.resolver.ts b/client/src/app/+videos/+video-edit/video-update.resolver.ts
index a391913d8..3a82324c3 100644
--- a/client/src/app/+videos/+video-edit/video-update.resolver.ts
+++ b/client/src/app/+videos/+video-edit/video-update.resolver.ts
@@ -1,13 +1,14 @@
1import { forkJoin } from 'rxjs' 1import { forkJoin, of } from 'rxjs'
2import { map, switchMap } from 'rxjs/operators' 2import { map, switchMap } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { ActivatedRouteSnapshot, Resolve } from '@angular/router' 4import { ActivatedRouteSnapshot, Resolve } from '@angular/router'
5import { VideoCaptionService, VideoChannelService, VideoService } from '@app/shared/shared-main' 5import { VideoCaptionService, VideoChannelService, VideoDetails, VideoLiveService, VideoService } from '@app/shared/shared-main'
6 6
7@Injectable() 7@Injectable()
8export class VideoUpdateResolver implements Resolve<any> { 8export class VideoUpdateResolver implements Resolve<any> {
9 constructor ( 9 constructor (
10 private videoService: VideoService, 10 private videoService: VideoService,
11 private videoLiveService: VideoLiveService,
11 private videoChannelService: VideoChannelService, 12 private videoChannelService: VideoChannelService,
12 private videoCaptionService: VideoCaptionService 13 private videoCaptionService: VideoCaptionService
13 ) { 14 ) {
@@ -18,32 +19,38 @@ export class VideoUpdateResolver implements Resolve<any> {
18 19
19 return this.videoService.getVideo({ videoId: uuid }) 20 return this.videoService.getVideo({ videoId: uuid })
20 .pipe( 21 .pipe(
21 switchMap(video => { 22 switchMap(video => forkJoin(this.buildVideoObservables(video))),
22 return forkJoin([ 23 map(([ video, videoChannels, videoCaptions, videoLive ]) => ({ video, videoChannels, videoCaptions, videoLive }))
23 this.videoService 24 )
24 .loadCompleteDescription(video.descriptionPath) 25 }
25 .pipe(map(description => Object.assign(video, { description }))),
26 26
27 this.videoChannelService 27 private buildVideoObservables (video: VideoDetails) {
28 .listAccountVideoChannels(video.account) 28 return [
29 .pipe( 29 this.videoService
30 map(result => result.data), 30 .loadCompleteDescription(video.descriptionPath)
31 map(videoChannels => videoChannels.map(c => ({ 31 .pipe(map(description => Object.assign(video, { description }))),
32 id: c.id,
33 label: c.displayName,
34 support: c.support,
35 avatarPath: c.avatar?.path
36 })))
37 ),
38 32
39 this.videoCaptionService 33 this.videoChannelService
40 .listCaptions(video.id) 34 .listAccountVideoChannels(video.account)
41 .pipe( 35 .pipe(
42 map(result => result.data) 36 map(result => result.data),
43 ) 37 map(videoChannels => videoChannels.map(c => ({
44 ]) 38 id: c.id,
45 }), 39 label: c.displayName,
46 map(([ video, videoChannels, videoCaptions ]) => ({ video, videoChannels, videoCaptions })) 40 support: c.support,
47 ) 41 avatarPath: c.avatar?.path
42 })))
43 ),
44
45 this.videoCaptionService
46 .listCaptions(video.id)
47 .pipe(
48 map(result => result.data)
49 ),
50
51 video.isLive
52 ? this.videoLiveService.getVideoLive(video.id)
53 : of(undefined)
54 ]
48 } 55 }
49} 56}