aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/hls.ts
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2021-05-05 22:25:37 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-05-06 08:47:43 +0200
commit66f77f63437c6774acbd72584a9839a7636ea167 (patch)
treefb9a3404109f1b079784e8f70bf82ba87bd0cbf3 /server/lib/hls.ts
parentb31d72625dd32143a45277528b90bb67a881f249 (diff)
downloadPeerTube-66f77f63437c6774acbd72584a9839a7636ea167.tar.gz
PeerTube-66f77f63437c6774acbd72584a9839a7636ea167.tar.zst
PeerTube-66f77f63437c6774acbd72584a9839a7636ea167.zip
server: fix HLS playlist format
Remove prefixed comma when there's no video codec.
Diffstat (limited to 'server/lib/hls.ts')
-rw-r--r--server/lib/hls.ts11
1 files changed, 5 insertions, 6 deletions
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) {
50 let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}` 50 let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}`
51 if (file.fps) line += ',FRAME-RATE=' + file.fps 51 if (file.fps) line += ',FRAME-RATE=' + file.fps
52 52
53 const videoCodec = await getVideoStreamCodec(videoFilePath) 53 const codecs = await Promise.all([
54 line += `,CODECS="${videoCodec}` 54 getVideoStreamCodec(videoFilePath),
55 getAudioStreamCodec(videoFilePath)
56 ])
55 57
56 const audioCodec = await getAudioStreamCodec(videoFilePath) 58 line += `,CODECS="${codecs.filter(c => !!c).join(',')}"`
57 if (audioCodec) line += `,${audioCodec}`
58
59 line += '"'
60 59
61 masterPlaylists.push(line) 60 masterPlaylists.push(line)
62 masterPlaylists.push(VideoStreamingPlaylistModel.getHlsPlaylistFilename(file.resolution)) 61 masterPlaylists.push(VideoStreamingPlaylistModel.getHlsPlaylistFilename(file.resolution))