aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/videos/embed.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/standalone/videos/embed.ts')
-rw-r--r--client/src/standalone/videos/embed.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index 2aabb5fe8..ea3436c7c 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -20,8 +20,8 @@ import 'whatwg-fetch'
20import * as vjs from 'video.js' 20import * as vjs from 'video.js'
21import * as Channel from 'jschannel' 21import * as Channel from 'jschannel'
22 22
23import { ResultList, VideoDetails } from '../../../../shared' 23import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared'
24import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player' 24import { addContextMenu, getServerTranslations, getVideojsOptions, loadLocaleInVideoJS } from '../../assets/player/peertube-player'
25import { PeerTubeResolution } from '../player/definitions' 25import { PeerTubeResolution } from '../player/definitions'
26import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings' 26import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings'
27import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' 27import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
@@ -257,8 +257,9 @@ class PeerTubeEmbed {
257 const lastPart = urlParts[ urlParts.length - 1 ] 257 const lastPart = urlParts[ urlParts.length - 1 ]
258 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] 258 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
259 259
260 await loadLocale(window.location.origin, vjs, navigator.language) 260 const [ , serverTranslations, videoResponse, captionsResponse ] = await Promise.all([
261 const [ videoResponse, captionsResponse ] = await Promise.all([ 261 loadLocaleInVideoJS(window.location.origin, vjs, navigator.language),
262 getServerTranslations(window.location.origin, navigator.language),
262 this.loadVideoInfo(videoId), 263 this.loadVideoInfo(videoId),
263 this.loadVideoCaptions(videoId) 264 this.loadVideoCaptions(videoId)
264 ]) 265 ])
@@ -274,7 +275,7 @@ class PeerTubeEmbed {
274 if (captionsResponse.ok) { 275 if (captionsResponse.ok) {
275 const { data } = (await captionsResponse.json()) as ResultList<VideoCaption> 276 const { data } = (await captionsResponse.json()) as ResultList<VideoCaption>
276 videoCaptions = data.map(c => ({ 277 videoCaptions = data.map(c => ({
277 label: c.language.label, 278 label: peertubeTranslate(c.language.label, serverTranslations),
278 language: c.language.id, 279 language: c.language.id,
279 src: window.location.origin + c.captionPath 280 src: window.location.origin + c.captionPath
280 })) 281 }))