1
0
Fork 0

server: fix HLS playlist format

Remove prefixed comma when there's no video codec.
This commit is contained in:
kontrollanten 2021-05-05 22:25:37 +02:00 committed by Chocobozzz
parent b31d72625d
commit 66f77f6343

View file

@ -50,13 +50,12 @@ async function updateMasterHLSPlaylist (video: MVideoWithFile) {
let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}`
if (file.fps) line += ',FRAME-RATE=' + file.fps
const videoCodec = await getVideoStreamCodec(videoFilePath)
line += `,CODECS="${videoCodec}`
const codecs = await Promise.all([
getVideoStreamCodec(videoFilePath),
getAudioStreamCodec(videoFilePath)
])
const audioCodec = await getAudioStreamCodec(videoFilePath)
if (audioCodec) line += `,${audioCodec}`
line += '"'
line += `,CODECS="${codecs.filter(c => !!c).join(',')}"`
masterPlaylists.push(line)
masterPlaylists.push(VideoStreamingPlaylistModel.getHlsPlaylistFilename(file.resolution))