- for (const playlistFile of playlistFiles) {
- const playlistPath = join(replayDirectory, playlistFile)
- const { videoFileResolution } = await getVideoFileResolution(playlistPath)
-
- // Put the final mp4 in the hls directory, and not in the replay directory
- const mp4TmpPath = buildMP4TmpPath(hlsDirectory, videoFileResolution)
-
- // Playlist name is for example 3.m3u8
- // Segments names are 3-0.ts 3-1.ts etc
- const shouldStartWith = playlistFile.replace(/\.m3u8$/, '') + '-'
-
- const segmentFiles = replayFiles.filter(f => f.startsWith(shouldStartWith) && f.endsWith('.ts'))
- await hlsPlaylistToFragmentedMP4(replayDirectory, segmentFiles, mp4TmpPath)
-
- if (!duration) {
- duration = await getDurationFromVideoFile(mp4TmpPath)
- }
-
- resolutions.push(videoFileResolution)
- }
+ const playlistFiles = rootFiles.filter(file => {
+ return file.endsWith('.m3u8') && file !== streamingPlaylist.playlistFilename
+ })