import './webtorrent-info-button'
import './peertube-videojs-plugin'
import './peertube-load-progress-bar'
+import './theater-button'
import { videojsUntyped } from './peertube-videojs-typings'
import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils'
-import { is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n'
+import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n'
// Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
peertubeLink: boolean,
poster: string,
startTime: number
+ theaterMode: boolean
}) {
const videojsOptions = {
controls: true,
function getControlBarChildren (options: {
peertubeLink: boolean
+ theaterMode: boolean
}) {
const children = {
'playToggle': {},
'seekBar': {
children: {
'peerTubeLoadProgressBar': {},
+ 'mouseTimeDisplay': {},
'playProgressBar': {}
}
}
})
}
+ if (options.theaterMode === true) {
+ Object.assign(children, {
+ 'theaterButton': {}
+ })
+ }
+
Object.assign(children, {
'fullscreenToggle': {}
})
}
function addContextMenu (player: any, videoEmbedUrl: string) {
- console.log(videoEmbedUrl)
-
player.contextmenuUI({
content: [
{
}
function loadLocale (serverUrl: string, videojs: any, locale: string) {
- if (!is18nLocale(locale) || isDefaultLocale(locale)) return undefined
+ const completeLocale = getCompleteLocale(locale)
+
+ if (!is18nLocale(completeLocale) || isDefaultLocale(completeLocale)) return Promise.resolve(undefined)
- return fetch(serverUrl + '/client/locales/' + locale + '/player.json')
+ return fetch(serverUrl + '/client/locales/' + completeLocale + '/player.json')
.then(res => res.json())
- .then(json => videojs.addLanguage(locale, json))
+ .then(json => videojs.addLanguage(getShortLocale(completeLocale), json))
}
export {