import './videojs-components/settings-panel'
import './videojs-components/settings-panel-child'
import './videojs-components/theater-button'
+import './playlist/playlist-plugin'
import videojs from 'video.js'
-import { isDefaultLocale } from '../../../../shared/models/i18n/i18n'
-import { VideoFile } from '../../../../shared/models/videos'
+import { isDefaultLocale } from '@shared/core-utils/i18n'
+import { VideoFile } from '@shared/models'
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
import { segmentValidatorFactory } from './p2p-media-loader/segment-validator'
import { getStoredP2PEnabled } from './peertube-player-local-storage'
-import { P2PMediaLoaderPluginOptions, UserWatching, VideoJSCaption, VideoJSPluginOptions } from './peertube-videojs-typings'
+import {
+ P2PMediaLoaderPluginOptions,
+ PlaylistPluginOptions,
+ UserWatching,
+ VideoJSCaption,
+ VideoJSPluginOptions
+} from './peertube-videojs-typings'
import { TranslationsManager } from './translations-manager'
import { buildVideoEmbed, buildVideoLink, copyToClipboard, getRtcConfig, isIOS, isSafari } from './utils'
autoplay: boolean
nextVideo?: Function
+
+ playlist?: PlaylistPluginOptions
+
videoDuration: number
enableHotkeys: boolean
inactivityTimeout: number
}
}
+ if (commonOptions.playlist) {
+ plugins.playlist = commonOptions.playlist
+ }
+
if (commonOptions.enableHotkeys === true) {
PeertubePlayerManager.addHotkeysOptions(plugins)
}
}
const hlsjs = {
levelLabelHandler: (level: { height: number, width: number }) => {
- const file = p2pMediaLoaderOptions.videoFiles.find(f => f.resolution.id === level.height)
+ const resolution = Math.min(level.height || 0, level.width || 0)
+
+ const file = p2pMediaLoaderOptions.videoFiles.find(f => f.resolution.id === resolution)
+ if (!file) {
+ console.error('Cannot find video file for level %d.', level.height)
+ return level.height
+ }
let label = file.resolution.label
if (file.fps >= 50) label += file.fps