diff options
Diffstat (limited to 'client/src/standalone')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 11 |
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' | |||
20 | import * as vjs from 'video.js' | 20 | import * as vjs from 'video.js' |
21 | import * as Channel from 'jschannel' | 21 | import * as Channel from 'jschannel' |
22 | 22 | ||
23 | import { ResultList, VideoDetails } from '../../../../shared' | 23 | import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared' |
24 | import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player' | 24 | import { addContextMenu, getServerTranslations, getVideojsOptions, loadLocaleInVideoJS } from '../../assets/player/peertube-player' |
25 | import { PeerTubeResolution } from '../player/definitions' | 25 | import { PeerTubeResolution } from '../player/definitions' |
26 | import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings' | 26 | import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings' |
27 | import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' | 27 | import { 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 | })) |