- for (const resolution of resolutions) {
- const videoInputPath = buildMP4TmpName(resolution)
- const { isPortraitMode } = await getVideoFileResolution(videoInputPath)
+ const hlsPlaylist = videoWithFiles.getHLSPlaylist()
+ await VideoFileModel.removeHLSFilesOfVideoId(hlsPlaylist.id)
+ hlsPlaylist.VideoFiles = []
+
+ const replayFiles = await readdir(replayDirectory)
+ let durationDone: boolean
+
+ for (const playlistFile of playlistFiles) {
+ const playlistPath = join(replayDirectory, playlistFile)
+ const { videoFileResolution, isPortraitMode } = await getVideoFileResolution(playlistPath)
+
+ // Playlist name is for example 3.m3u8
+ // Segments names are 3-0.ts 3-1.ts etc
+ const shouldStartWith = playlistFile.replace(/\.m3u8$/, '') + '-'