import '@peertube/videojs-contextmenu'
-import './upnext/end-card'
-import './upnext/upnext-plugin'
-import './stats/stats-card'
-import './stats/stats-plugin'
-import './bezels/bezels-plugin'
-import './peertube-plugin'
-import './peertube-resolutions-plugin'
-import './control-bar/next-previous-video-button'
-import './control-bar/p2p-info-button'
-import './control-bar/peertube-link-button'
-import './control-bar/peertube-load-progress-bar'
-import './control-bar/resolution-menu-button'
-import './control-bar/resolution-menu-item'
-import './control-bar/settings-dialog'
-import './control-bar/settings-menu-button'
-import './control-bar/settings-menu-item'
-import './control-bar/settings-panel'
-import './control-bar/settings-panel-child'
-import './control-bar/theater-button'
-import './playlist/playlist-plugin'
-import './mobile/peertube-mobile-plugin'
-import './mobile/peertube-mobile-buttons'
-import './hotkeys/peertube-hotkeys-plugin'
+import './shared/upnext/end-card'
+import './shared/upnext/upnext-plugin'
+import './shared/stats/stats-card'
+import './shared/stats/stats-plugin'
+import './shared/bezels/bezels-plugin'
+import './shared/peertube/peertube-plugin'
+import './shared/resolutions/peertube-resolutions-plugin'
+import './shared/control-bar/next-previous-video-button'
+import './shared/control-bar/p2p-info-button'
+import './shared/control-bar/peertube-link-button'
+import './shared/control-bar/peertube-load-progress-bar'
+import './shared/control-bar/theater-button'
+import './shared/settings/resolution-menu-button'
+import './shared/settings/resolution-menu-item'
+import './shared/settings/settings-dialog'
+import './shared/settings/settings-menu-button'
+import './shared/settings/settings-menu-item'
+import './shared/settings/settings-panel'
+import './shared/settings/settings-panel-child'
+import './shared/playlist/playlist-plugin'
+import './shared/mobile/peertube-mobile-plugin'
+import './shared/mobile/peertube-mobile-buttons'
+import './shared/hotkeys/peertube-hotkeys-plugin'
+import './shared/metrics/metrics-plugin'
import videojs from 'video.js'
+import { logger } from '@root-helpers/logger'
import { PluginsManager } from '@root-helpers/plugins-manager'
+import { isMobile } from '@root-helpers/web-browser'
import { saveAverageBandwidth } from './peertube-player-local-storage'
-import { CommonOptions, PeertubePlayerManagerOptions, PeertubePlayerOptionsBuilder, PlayerMode } from './peertube-player-options-builder'
-import { PlayerNetworkInfo } from './peertube-videojs-typings'
+import { ManagerOptionsBuilder } from './shared/manager-options'
import { TranslationsManager } from './translations-manager'
-import { isMobile } from './utils'
+import { CommonOptions, PeertubePlayerManagerOptions, PlayerMode, PlayerNetworkInfo } from './types'
// Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
(videojs.getComponent('PlaybackRateMenuButton') as any).prototype.controlText_ = 'Speed'
this.onPlayerChange = onPlayerChange
this.playerElementClassName = options.common.playerElement.className
- if (mode === 'webtorrent') await import('./webtorrent/webtorrent-plugin')
+ if (mode === 'webtorrent') await import('./shared/webtorrent/webtorrent-plugin')
if (mode === 'p2p-media-loader') {
const [ p2pMediaLoaderModule ] = await Promise.all([
import('@peertube/p2p-media-loader-hlsjs'),
- import('./p2p-media-loader/p2p-media-loader-plugin')
+ import('./shared/p2p-media-loader/p2p-media-loader-plugin')
])
this.p2pMediaLoaderModule = p2pMediaLoaderModule
}
private static async buildPlayer (mode: PlayerMode, options: PeertubePlayerManagerOptions): Promise<videojs.Player> {
- const videojsOptionsBuilder = new PeertubePlayerOptionsBuilder(mode, options, this.p2pMediaLoaderModule)
+ const videojsOptionsBuilder = new ManagerOptionsBuilder(mode, options, this.p2pMediaLoaderModule)
const videojsOptions = await this.pluginsManager.runHook(
'filter:internal.player.videojs.options.result',
if (isMobile()) player.peertubeMobile()
if (options.common.enableHotkeys === true) player.peerTubeHotkeysPlugin()
+ if (options.common.controlBar === false) player.controlBar.addClass('control-bar-hidden')
player.bezels()
return
}
- console.log('Fast forwarding HLS to recover from an error.')
+ logger.info('Fast forwarding HLS to recover from an error.')
this.videojsDecodeErrors++
return
}
- console.log('Fallback to webtorrent.')
+ logger.info('Fallback to webtorrent.')
this.rebuildAndUpdateVideoElement(currentPlayer, options.common)
- await import('./webtorrent/webtorrent-plugin')
+ await import('./shared/webtorrent/webtorrent-plugin')
const newPlayer = await this.buildPlayer('webtorrent', options)
this.onPlayerChange(newPlayer)
return newVideoElement
}
- private static addContextMenu (optionsBuilder: PeertubePlayerOptionsBuilder, player: videojs.Player, commonOptions: CommonOptions) {
+ private static addContextMenu (optionsBuilder: ManagerOptionsBuilder, player: videojs.Player, commonOptions: CommonOptions) {
const options = optionsBuilder.getContextMenuOptions(player, commonOptions)
player.contextmenuUI(options)