aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-06 14:23:40 +0200
committerChocobozzz <me@florianbigard.com>2018-06-06 16:48:40 +0200
commite945b184a0f29b47c33bbd05578f3493ca9c8e6c (patch)
tree46c821006d170e6e28658d978e313761adfaf55a /client/src/app
parent550a562ceca45ea78d6f7054024c8d3a6b89c30c (diff)
downloadPeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.tar.gz
PeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.tar.zst
PeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.zip
Localize player
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts19
1 files changed, 14 insertions, 5 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 23d74494c..d3e16c4cf 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -1,5 +1,5 @@
1import { catchError } from 'rxjs/operators' 1import { catchError } from 'rxjs/operators'
2import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' 2import { Component, ElementRef, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild, Inject } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { RedirectService } from '@app/core/routing/redirect.service' 4import { RedirectService } from '@app/core/routing/redirect.service'
5import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' 5import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
@@ -21,9 +21,10 @@ import { MarkdownService } from '../shared'
21import { VideoDownloadComponent } from './modal/video-download.component' 21import { VideoDownloadComponent } from './modal/video-download.component'
22import { VideoReportComponent } from './modal/video-report.component' 22import { VideoReportComponent } from './modal/video-report.component'
23import { VideoShareComponent } from './modal/video-share.component' 23import { VideoShareComponent } from './modal/video-share.component'
24import { getVideojsOptions } from '../../../assets/player/peertube-player' 24import { getVideojsOptions, loadLocale, addContextMenu } from '../../../assets/player/peertube-player'
25import { ServerService } from '@app/core' 25import { ServerService } from '@app/core'
26import { I18n } from '@ngx-translate/i18n-polyfill' 26import { I18n } from '@ngx-translate/i18n-polyfill'
27import { environment } from '../../../environments/environment'
27 28
28@Component({ 29@Component({
29 selector: 'my-video-watch', 30 selector: 'my-video-watch',
@@ -54,6 +55,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
54 likesBarTooltipText = '' 55 likesBarTooltipText = ''
55 hasAlreadyAcceptedPrivacyConcern = false 56 hasAlreadyAcceptedPrivacyConcern = false
56 57
58 private videojsLocaleLoaded = false
57 private otherVideos: Video[] = [] 59 private otherVideos: Video[] = []
58 private paramsSub: Subscription 60 private paramsSub: Subscription
59 61
@@ -72,7 +74,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
72 private markdownService: MarkdownService, 74 private markdownService: MarkdownService,
73 private zone: NgZone, 75 private zone: NgZone,
74 private redirectService: RedirectService, 76 private redirectService: RedirectService,
75 private i18n: I18n 77 private i18n: I18n,
78 @Inject(LOCALE_ID) private localeId: string
76 ) {} 79 ) {}
77 80
78 get user () { 81 get user () {
@@ -365,7 +368,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
365 inactivityTimeout: 2500, 368 inactivityTimeout: 2500,
366 videoFiles: this.video.files, 369 videoFiles: this.video.files,
367 playerElement: this.playerElement, 370 playerElement: this.playerElement,
368 videoEmbedUrl: this.video.embedUrl,
369 videoViewUrl: this.videoService.getVideoViewUrl(this.video.uuid), 371 videoViewUrl: this.videoService.getVideoViewUrl(this.video.uuid),
370 videoDuration: this.video.duration, 372 videoDuration: this.video.duration,
371 enableHotkeys: true, 373 enableHotkeys: true,
@@ -374,11 +376,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
374 startTime 376 startTime
375 }) 377 })
376 378
379 if (this.videojsLocaleLoaded === false) {
380 await loadLocale(environment.apiUrl, videojs, environment.production === true ? this.localeId : 'fr')
381 this.videojsLocaleLoaded = true
382 }
383
377 const self = this 384 const self = this
378 this.zone.runOutsideAngular(() => { 385 this.zone.runOutsideAngular(async () => {
379 videojs(this.playerElement, videojsOptions, function () { 386 videojs(this.playerElement, videojsOptions, function () {
380 self.player = this 387 self.player = this
381 this.on('customError', (event, data) => self.handleError(data.err)) 388 this.on('customError', (event, data) => self.handleError(data.err))
389
390 addContextMenu(self.player, self.video.embedUrl)
382 }) 391 })
383 }) 392 })
384 393