aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main/video-caption/video-caption.service.ts')
-rw-r--r--client/src/app/shared/shared-main/video-caption/video-caption.service.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
index 97b79d842..67eb09e4d 100644
--- a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
+++ b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
@@ -8,6 +8,7 @@ import { VideoService } from '@app/shared/shared-main/video'
8import { peertubeTranslate } from '@shared/core-utils/i18n' 8import { peertubeTranslate } from '@shared/core-utils/i18n'
9import { ResultList, VideoCaption } from '@shared/models' 9import { ResultList, VideoCaption } from '@shared/models'
10import { VideoCaptionEdit } from './video-caption-edit.model' 10import { VideoCaptionEdit } from './video-caption-edit.model'
11import { environment } from '../../../../environments/environment'
11 12
12@Injectable() 13@Injectable()
13export class VideoCaptionService { 14export class VideoCaptionService {
@@ -57,7 +58,7 @@ export class VideoCaptionService {
57 let obs: Observable<any> = of(undefined) 58 let obs: Observable<any> = of(undefined)
58 59
59 for (const videoCaption of videoCaptions) { 60 for (const videoCaption of videoCaptions) {
60 if (videoCaption.action === 'CREATE') { 61 if (videoCaption.action === 'CREATE' || videoCaption.action === 'UPDATE') {
61 obs = obs.pipe(switchMap(() => this.addCaption(videoId, videoCaption.language.id, videoCaption.captionfile))) 62 obs = obs.pipe(switchMap(() => this.addCaption(videoId, videoCaption.language.id, videoCaption.captionfile)))
62 } else if (videoCaption.action === 'REMOVE') { 63 } else if (videoCaption.action === 'REMOVE') {
63 obs = obs.pipe(switchMap(() => this.removeCaption(videoId, videoCaption.language.id))) 64 obs = obs.pipe(switchMap(() => this.removeCaption(videoId, videoCaption.language.id)))
@@ -66,4 +67,8 @@ export class VideoCaptionService {
66 67
67 return obs 68 return obs
68 } 69 }
70
71 getCaptionContent ({ captionPath }: Pick<VideoCaption, 'captionPath'>) {
72 return this.authHttp.get(`${environment.originServerUrl}${captionPath}`, { responseType: 'text' })
73 }
69} 74}