1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Fix feed audio file mimetype

This commit is contained in:
Chocobozzz 2023-10-03 12:20:11 +02:00
parent 5cea8f9567
commit 1611721c9b
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 58 additions and 28 deletions

View file

@ -8,6 +8,7 @@ import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudi
import { lTags } from './object-storage/shared/index.js'
import { generateHLSVideoFilename, generateWebVideoFilename } from './paths.js'
import { VideoPathManager } from './video-path-manager.js'
import { MIMETYPES } from '@server/initializers/constants.js'
async function buildNewFile (options: {
path: string
@ -130,6 +131,12 @@ async function buildFileMetadata (path: string, existingProbe?: FfprobeData) {
return new VideoFileMetadata(metadata)
}
function getVideoFileMimeType (extname: string, isAudio: boolean) {
return isAudio && extname === '.mp4' // We use .mp4 even for audio file only
? MIMETYPES.AUDIO.EXT_MIMETYPE['.m4a']
: MIMETYPES.VIDEO.EXT_MIMETYPE[extname]
}
// ---------------------------------------------------------------------------
export {
@ -140,5 +147,6 @@ export {
removeAllWebVideoFiles,
removeWebVideoFile,
buildFileMetadata
buildFileMetadata,
getVideoFileMimeType
}