-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import './pause-bezel'
const Plugin = videojs.getPlugin('plugin')
class BezelsPlugin extends Plugin {
- constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options?: videojs.ComponentOptions) {
super(player)
this.player.ready(() => {
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
function getPauseBezel () {
return `
class PauseBezel extends Component {
container: HTMLDivElement
- constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options?: videojs.ComponentOptions) {
super(player, options)
player.on('pause', (_: any) => {
// We duplicated this plugin to choose the hls.js version we want, because streamroot only provide a bundled file
import * as Hlsjs from 'hls.js/dist/hls.light.js'
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { HlsjsConfigHandlerOptions, QualityLevelRepresentation, QualityLevels, VideoJSTechHLS } from '../peertube-videojs-typings'
type ErrorCounts = {
(vjs as any).Html5Hlsjs = Html5Hlsjs
}
-function hlsjsConfigHandler (this: VideoJsPlayer, options: HlsjsConfigHandlerOptions) {
+function hlsjsConfigHandler (this: videojs.Player, options: HlsjsConfigHandlerOptions) {
const player = this
if (!options) return
private readonly videoElement: HTMLVideoElement
private readonly errorCounts: ErrorCounts = {}
- private readonly player: VideoJsPlayer
+ private readonly player: videojs.Player
private readonly tech: videojs.Tech
private readonly source: videojs.Tech.SourceObject
private readonly vjs: typeof videojs
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../peertube-videojs-typings'
import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs'
import { Events, Segment } from 'p2p-media-loader-core'
private networkInfoInterval: any
- constructor (player: VideoJsPlayer, options?: P2PMediaLoaderPluginOptions) {
+ constructor (player: videojs.Player, options?: P2PMediaLoaderPluginOptions) {
super(player)
this.options = options
import { VideoFile } from '../../../../shared/models/videos'
-import videojs, { VideoJsPlayer, VideoJsPlayerOptions } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import 'videojs-hotkeys'
import 'videojs-dock'
import 'videojs-contextmenu-ui'
export class PeertubePlayerManager {
private static playerElementClassName: string
- private static onPlayerChange: (player: VideoJsPlayer) => void
+ private static onPlayerChange: (player: videojs.Player) => void
- static async initialize (mode: PlayerMode, options: PeertubePlayerManagerOptions, onPlayerChange: (player: VideoJsPlayer) => void) {
+ static async initialize (mode: PlayerMode, options: PeertubePlayerManagerOptions, onPlayerChange: (player: videojs.Player) => void) {
let p2pMediaLoader: any
this.onPlayerChange = onPlayerChange
const self = this
return new Promise(res => {
- videojs(options.common.playerElement, videojsOptions, function (this: VideoJsPlayer) {
+ videojs(options.common.playerElement, videojsOptions, function (this: videojs.Player) {
const player = this
let alreadyFallback = false
const videojsOptions = this.getVideojsOptions(mode, options)
const self = this
- videojs(newVideoElement, videojsOptions, function (this: VideoJsPlayer) {
+ videojs(newVideoElement, videojsOptions, function (this: videojs.Player) {
const player = this
self.addContextMenu(mode, player, options.common.embedUrl)
mode: PlayerMode,
options: PeertubePlayerManagerOptions,
p2pMediaLoaderModule?: any
- ): VideoJsPlayerOptions {
+ ): videojs.PlayerOptions {
const commonOptions = options.common
let autoplay = commonOptions.autoplay
return children
}
- private static addContextMenu (mode: PlayerMode, player: VideoJsPlayer, videoEmbedUrl: string) {
+ private static addContextMenu (mode: PlayerMode, player: videojs.Player, videoEmbedUrl: string) {
const content = [
{
label: player.localize('Copy the video URL'),
},
{
label: player.localize('Copy the video URL at the current time'),
- listener: function (this: VideoJsPlayer) {
+ listener: function (this: videojs.Player) {
copyToClipboard(buildVideoLink({ startTime: this.currentTime() }))
}
},
if (mode === 'webtorrent') {
content.push({
label: player.localize('Copy magnet URI'),
- listener: function (this: VideoJsPlayer) {
+ listener: function (this: videojs.Player) {
copyToClipboard(this.webtorrent().getCurrentVideoFile().magnetUri)
}
})
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core'
import './videojs-components/settings-menu-button'
import {
PeerTubePluginOptions,
private mouseInControlBar = false
private readonly savedInactivityTimeout: number
- constructor (player: VideoJsPlayer, options?: PeerTubePluginOptions) {
+ constructor (player: videojs.Player, options?: PeerTubePluginOptions) {
super(player)
this.videoViewUrl = options.videoViewUrl
import { PlayerMode } from './peertube-player-manager'
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
import { VideoFile } from '@shared/models'
-import videojs from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { Config, Level } from 'hls.js'
declare module 'video.js' {
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
function getMainTemplate (options: any) {
return `
suspendedMessage: HTMLElement
nextButton: HTMLElement
- constructor (player: VideoJsPlayer, options: EndCardOptions) {
+ constructor (player: videojs.Player, options: EndCardOptions) {
super(player, options)
this.totalTicks = this.options_.timeout / this.interval
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { EndCardOptions } from './end-card'
const Plugin = videojs.getPlugin('plugin')
class UpNextPlugin extends Plugin {
- constructor (player: VideoJsPlayer, options: Partial<EndCardOptions> = {}) {
+ constructor (player: videojs.Player, options: Partial<EndCardOptions> = {}) {
const settings = {
next: options.next,
getTitle: options.getTitle,
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
const Button = videojs.getComponent('Button')
class NextVideoButton extends Button {
private readonly nextVideoButtonOptions: NextVideoButtonOptions
- constructor (player: VideoJsPlayer, options?: NextVideoButtonOptions) {
+ constructor (player: videojs.Player, options?: NextVideoButtonOptions) {
super(player, options)
this.nextVideoButtonOptions = options
import { PlayerNetworkInfo } from '../peertube-videojs-typings'
-import videojs from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { bytes } from '../utils'
const Button = videojs.getComponent('Button')
import { buildVideoLink } from '../utils'
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
const Button = videojs.getComponent('Button')
class PeerTubeLinkButton extends Button {
- constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options?: videojs.ComponentOptions) {
super(player, options)
}
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
const Component = videojs.getComponent('Component')
class PeerTubeLoadProgressBar extends Component {
- constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options?: videojs.ComponentOptions) {
super(player, options)
this.on(player, 'progress', this.update)
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { LoadedQualityData } from '../peertube-videojs-typings'
import { ResolutionMenuItem } from './resolution-menu-item'
class ResolutionMenuButton extends MenuButton {
labelEl_: HTMLElement
- constructor (player: VideoJsPlayer, options?: videojs.MenuButtonOptions) {
+ constructor (player: videojs.Player, options?: videojs.MenuButtonOptions) {
super(player, options)
this.controlText('Quality')
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { AutoResolutionUpdateData, ResolutionUpdateData } from '../peertube-videojs-typings'
const MenuItem = videojs.getComponent('MenuItem')
private autoResolutionPossible: boolean
private currentResolutionLabel: string
- constructor (player: VideoJsPlayer, options?: ResolutionMenuItemOptions) {
+ constructor (player: videojs.Player, options?: ResolutionMenuItemOptions) {
options.selectable = true
super(player, options)
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
const Component = videojs.getComponent('Component')
class SettingsDialog extends Component {
- constructor (player: VideoJsPlayer) {
+ constructor (player: videojs.Player) {
super(player)
this.hide()
// Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu
import { SettingsMenuItem } from './settings-menu-item'
import { toTitleCase } from '../utils'
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { SettingsDialog } from './settings-dialog'
import { SettingsPanel } from './settings-panel'
private settingsButtonOptions: SettingsButtonOptions
- constructor (player: VideoJsPlayer, options?: SettingsButtonOptions) {
+ constructor (player: videojs.Player, options?: SettingsButtonOptions) {
super(player, options)
this.settingsButtonOptions = options
// Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu
import { toTitleCase } from '../utils'
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { SettingsButton } from './settings-menu-button'
import { SettingsDialog } from './settings-dialog'
import { SettingsPanel } from './settings-panel'
settingsSubMenuValueEl_: HTMLElement
settingsSubMenuEl_: HTMLElement
- constructor (player: VideoJsPlayer, options?: SettingsMenuItemOptions) {
+ constructor (player: videojs.Player, options?: SettingsMenuItemOptions) {
super(player, options)
this.settingsButton = options.menuButton
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
const Component = videojs.getComponent('Component')
class SettingsPanelChild extends Component {
- constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options?: videojs.ComponentOptions) {
super(player, options)
}
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
const Component = videojs.getComponent('Component')
class SettingsPanel extends Component {
- constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options?: videojs.ComponentOptions) {
super(player, options)
}
-import videojs, { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { saveTheaterInStore, getStoredTheater } from '../peertube-player-local-storage'
const Button = videojs.getComponent('Button')
private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled'
- constructor (player: VideoJsPlayer, options: videojs.ComponentOptions) {
+ constructor (player: videojs.Player, options: videojs.ComponentOptions) {
super(player, options)
const enabled = getStoredTheater()
-import videojs, { VideoJsPlayer } from 'video.js'
-
+import videojs from 'video.js/dist/alt/video.core.js'
import * as WebTorrent from 'webtorrent'
import { renderVideo } from './video-renderer'
import { LoadedQualityData, PlayerNetworkInfo, WebtorrentPluginOptions } from '../peertube-videojs-typings'
private readonly autoplay: boolean = false
private readonly startTime: number = 0
- private readonly savePlayerSrcFunction: VideoJsPlayer['src']
+ private readonly savePlayerSrcFunction: videojs.Player['src']
private readonly videoDuration: number
private readonly CONSTANTS = {
INFO_SCHEDULER: 1000, // Don't change this
private downloadSpeeds: number[] = []
- constructor (player: VideoJsPlayer, options?: WebtorrentPluginOptions) {
+ constructor (player: videojs.Player, options?: WebtorrentPluginOptions) {
super(player)
this.startTime = timeToInt(options.startTime)
import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type'
import { PeerTubeEmbedApi } from './embed-api'
import { TranslationsManager } from '../../assets/player/translations-manager'
-import { VideoJsPlayer } from 'video.js'
+import videojs from 'video.js/dist/alt/video.core.js'
import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings'
type Translations = { [ id: string ]: string }
export class PeerTubeEmbed {
videoElement: HTMLVideoElement
- player: VideoJsPlayer
+ player: videojs.Player
api: PeerTubeEmbedApi = null
autoplay: boolean
controls: boolean
})
}
- this.player = await PeertubePlayerManager.initialize(this.mode, options, (player: VideoJsPlayer) => this.player = player)
+ this.player = await PeertubePlayerManager.initialize(this.mode, options, (player: videojs.Player) => this.player = player)
this.player.on('customError', (event: any, data: any) => this.handleError(data.err, serverTranslations))
window[ 'videojsPlayer' ] = this.player
"paths": {
"@app/*": [ "src/app/*" ],
"@shared/*": [ "../shared/*" ],
- "video.js": [ "node_modules/video.js/dist/alt/video.core" ],
- "fs": [ "src/shims/noop" ],
- "http": [ "src/shims/http" ],
- "https": [ "src/shims/https" ],
- "path": [ "src/shims/path" ],
- "stream": [ "src/shims/noop" ],
- "crypto": [ "src/shims/noop" ]
+ "fs": [ "src/shims/noop.ts" ],
+ "http": [ "src/shims/http.ts" ],
+ "https": [ "src/shims/https.ts" ],
+ "path": [ "src/shims/path.ts" ],
+ "stream": [ "src/shims/noop.ts" ],
+ "crypto": [ "src/shims/noop.ts" ]
}
},
"angularCompilerOptions": {