- // Playlist name is for example 3.m3u8
- // Segments names are 3-0.ts 3-1.ts etc
- const shouldStartWith = playlistFile.replace(/\.m3u8$/, '') + '-'
-
- const segmentFiles = files.filter(f => f.startsWith(shouldStartWith) && f.endsWith('.ts'))
- await hlsPlaylistToFragmentedMP4(hlsDirectory, segmentFiles, mp4TmpPath)
-
- if (!duration) {
- duration = await getDurationFromVideoFile(mp4TmpPath)
+ for (const file of rootFiles) {
+ // Move remaining files in the replay directory
+ if (file.endsWith('.ts') || file.endsWith('.m3u8')) {
+ await copy(join(hlsDirectory, file), join(replayDirectory, file))