From db216afd980846c418a4ebab8190c3ead561dfc1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Apr 2017 14:57:05 +0200 Subject: Client: support video language --- client/src/app/videos/shared/video.model.ts | 3 +++ client/src/app/videos/shared/video.service.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'client/src/app/videos/shared') diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index 3c588c446..f135ca707 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts @@ -6,6 +6,7 @@ export class Video { createdAt: Date; categoryLabel: string; licenceLabel: string; + languageLabel: string; description: string; duration: string; id: string; @@ -38,6 +39,7 @@ export class Video { createdAt: string, categoryLabel: string, licenceLabel: string, + languageLabel: string; description: string, duration: number; id: string, @@ -56,6 +58,7 @@ export class Video { this.createdAt = new Date(hash.createdAt); this.categoryLabel = hash.categoryLabel; this.licenceLabel = hash.licenceLabel; + this.languageLabel = hash.languageLabel; this.description = hash.description; this.duration = Video.createDurationString(hash.duration); this.id = hash.id; diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index 15f017e33..13d4ca246 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -24,6 +24,7 @@ export class VideoService { videoCategories: Array<{ id: number, label: string }> = []; videoLicences: Array<{ id: number, label: string }> = []; + videoLanguages: Array<{ id: number, label: string }> = []; constructor( private authService: AuthService, @@ -59,6 +60,19 @@ export class VideoService { }); } + loadVideoLanguages() { + return this.http.get(VideoService.BASE_VIDEO_URL + 'languages') + .map(this.restExtractor.extractDataGet) + .subscribe(data => { + Object.keys(data).forEach(languageKey => { + this.videoLanguages.push({ + id: parseInt(languageKey), + label: data[languageKey] + }); + }); + }); + } + getVideo(id: string): Observable