diff options
Diffstat (limited to 'client/src/standalone')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index d603690ca..166013226 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -14,14 +14,14 @@ import 'core-js/es6/regexp' | |||
14 | import 'core-js/es6/map' | 14 | import 'core-js/es6/map' |
15 | import 'core-js/es6/weak-map' | 15 | import 'core-js/es6/weak-map' |
16 | import 'core-js/es6/set' | 16 | import 'core-js/es6/set' |
17 | |||
18 | // For google bot that uses Chrome 41 and does not understand fetch | 17 | // For google bot that uses Chrome 41 and does not understand fetch |
19 | import 'whatwg-fetch' | 18 | import 'whatwg-fetch' |
20 | 19 | ||
21 | import * as videojs from 'video.js' | 20 | import * as videojs from 'video.js' |
22 | 21 | ||
23 | import { VideoDetails } from '../../../../shared' | 22 | import { VideoDetails } from '../../../../shared' |
24 | import { getVideojsOptions } from '../../assets/player/peertube-player' | 23 | import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player' |
24 | import { environment } from '../../environments/environment' | ||
25 | 25 | ||
26 | function getVideoUrl (id: string) { | 26 | function getVideoUrl (id: string) { |
27 | return window.location.origin + '/api/v1/videos/' + id | 27 | return window.location.origin + '/api/v1/videos/' + id |
@@ -61,7 +61,8 @@ function videoFetchError (videoElement: HTMLVideoElement) { | |||
61 | const urlParts = window.location.href.split('/') | 61 | const urlParts = window.location.href.split('/') |
62 | const videoId = urlParts[urlParts.length - 1] | 62 | const videoId = urlParts[urlParts.length - 1] |
63 | 63 | ||
64 | loadVideoInfo(videoId) | 64 | loadLocale(environment.apiUrl, videojs, navigator.language) |
65 | .then(() => loadVideoInfo(videoId)) | ||
65 | .then(async response => { | 66 | .then(async response => { |
66 | const videoContainerId = 'video-container' | 67 | const videoContainerId = 'video-container' |
67 | const videoElement = document.getElementById(videoContainerId) as HTMLVideoElement | 68 | const videoElement = document.getElementById(videoContainerId) as HTMLVideoElement |
@@ -91,7 +92,6 @@ loadVideoInfo(videoId) | |||
91 | const videojsOptions = getVideojsOptions({ | 92 | const videojsOptions = getVideojsOptions({ |
92 | autoplay, | 93 | autoplay, |
93 | inactivityTimeout: 1500, | 94 | inactivityTimeout: 1500, |
94 | videoEmbedUrl: window.location.origin + videoInfo.embedPath, | ||
95 | videoViewUrl: getVideoUrl(videoId) + '/views', | 95 | videoViewUrl: getVideoUrl(videoId) + '/views', |
96 | playerElement: videoElement, | 96 | playerElement: videoElement, |
97 | videoFiles: videoInfo.files, | 97 | videoFiles: videoInfo.files, |
@@ -106,8 +106,10 @@ loadVideoInfo(videoId) | |||
106 | 106 | ||
107 | player.dock({ | 107 | player.dock({ |
108 | title: videoInfo.name, | 108 | title: videoInfo.name, |
109 | description: 'Uses P2P, others may know you are watching this video.' | 109 | description: player.localize('Uses P2P, others may know you are watching this video.') |
110 | }) | 110 | }) |
111 | |||
112 | addContextMenu(player, window.location.origin + videoInfo.embedPath) | ||
111 | }) | 113 | }) |
112 | }) | 114 | }) |
113 | .catch(err => console.error(err)) | 115 | .catch(err => console.error(err)) |