From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Wed, 5 May 2021 20:25:37 +0000 (+0200) Subject: server: fix HLS playlist format X-Git-Tag: v3.2.0-rc.1~50 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=66f77f63437c6774acbd72584a9839a7636ea167;hp=b31d72625dd32143a45277528b90bb67a881f249;p=github%2FChocobozzz%2FPeerTube.git server: fix HLS playlist format Remove prefixed comma when there's no video codec. --- diff --git a/server/lib/hls.ts b/server/lib/hls.ts index 84539e2c1..05be403f3 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts @@ -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))