aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/videos/embed.ts
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/standalone/videos/embed.ts
parent550a562ceca45ea78d6f7054024c8d3a6b89c30c (diff)
downloadPeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.tar.gz
PeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.tar.zst
PeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.zip
Localize player
Diffstat (limited to 'client/src/standalone/videos/embed.ts')
-rw-r--r--client/src/standalone/videos/embed.ts12
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'
14import 'core-js/es6/map' 14import 'core-js/es6/map'
15import 'core-js/es6/weak-map' 15import 'core-js/es6/weak-map'
16import 'core-js/es6/set' 16import '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
19import 'whatwg-fetch' 18import 'whatwg-fetch'
20 19
21import * as videojs from 'video.js' 20import * as videojs from 'video.js'
22 21
23import { VideoDetails } from '../../../../shared' 22import { VideoDetails } from '../../../../shared'
24import { getVideojsOptions } from '../../assets/player/peertube-player' 23import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player'
24import { environment } from '../../environments/environment'
25 25
26function getVideoUrl (id: string) { 26function 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) {
61const urlParts = window.location.href.split('/') 61const urlParts = window.location.href.split('/')
62const videoId = urlParts[urlParts.length - 1] 62const videoId = urlParts[urlParts.length - 1]
63 63
64loadVideoInfo(videoId) 64loadLocale(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))