X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fhls.ts;h=05be403f33a1dffba37248228a3d3a8143bc0a5e;hb=1f256e7d3cf056c2d999260155cdba58ae1b878b;hp=04187668c7afd4f2b24b8a50da8dad624c112edd;hpb=90a8bd305de4153ec21137a73ff482dcc2e3e19b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/hls.ts b/server/lib/hls.ts index 04187668c..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)) @@ -135,7 +134,7 @@ function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, const destPath = join(tmpDirectory, basename(fileUrl)) const bodyKBLimit = 10 * 1000 * 1000 // 10GB - await doRequestAndSaveToFile({ uri: fileUrl }, destPath, bodyKBLimit) + await doRequestAndSaveToFile(fileUrl, destPath, { bodyKBLimit }) } clearTimeout(timer) @@ -156,7 +155,7 @@ function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, } async function fetchUniqUrls (playlistUrl: string) { - const { body } = await doRequest({ uri: playlistUrl }) + const { body } = await doRequest(playlistUrl) if (!body) return []