import './videojs-components/settings-panel-child'
import './videojs-components/theater-button'
import videojs from 'video.js'
+
import { isDefaultLocale } from '../../../../shared/models/i18n/i18n'
import { VideoFile } from '../../../../shared/models/videos'
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
}
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
}
}
-function computeResolutionsToTranscode (videoFileHeight: number) {
+function computeResolutionsToTranscode (videoFileResolution: number) {
const resolutionsEnabled: number[] = []
const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS
]
for (const resolution of resolutions) {
- if (configResolutions[resolution + 'p'] === true && videoFileHeight > resolution) {
+ if (configResolutions[resolution + 'p'] === true && videoFileResolution > resolution) {
resolutionsEnabled.push(resolution)
}
}
if (videoArg === undefined) return undefined
// Outside the transaction (IO on disk)
- const { videoFileResolution } = await videoArg.getMaxQualityResolution()
+ const { videoFileResolution, isPortraitMode } = await videoArg.getMaxQualityResolution()
const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => {
// Maybe the video changed in database, refresh it
// Create transcoding jobs if there are enabled resolutions
const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution)
logger.info(
- 'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, videoFileResolution,
+ 'Resolutions computed for video %s and origin file resolution of %d.', videoDatabase.uuid, videoFileResolution,
{ resolutions: resolutionsEnabled }
)
dataInput = {
type: 'new-resolution' as 'new-resolution',
videoUUID: videoDatabase.uuid,
- resolution
+ resolution,
+ isPortraitMode
}
} else if (CONFIG.TRANSCODING.HLS.ENABLED) {
dataInput = {
type: 'hls',
videoUUID: videoDatabase.uuid,
resolution,
- isPortraitMode: false,
+ isPortraitMode,
copyCodecs: false
}
}