- const concatFilePath = join(options.replayDirectory, 'concat.txt')
-
- function cleaner () {
- remove(concatFilePath)
- .catch(err => logger.error('Cannot remove concat file in %s.', options.replayDirectory, { err }))
- }
-
- // First concat the ts files to a mp4 file
- const content = options.segmentFiles.map(f => 'file ' + f)
- .join('\n')
-
- await writeFile(concatFilePath, content + '\n')
-
- try {
- const outputPath = await generateHlsPlaylistCommon({
- video: options.video,
- resolution: options.resolution,
- isPortraitMode: options.isPortraitMode,
- inputPath: concatFilePath,
- type: 'hls-from-ts' as 'hls-from-ts'
- })
-
- cleaner()
-
- return outputPath
- } catch (err) {
- cleaner()
-
- throw err
- }
+ return generateHlsPlaylistCommon({
+ video: options.video,
+ resolution: options.resolution,
+ isPortraitMode: options.isPortraitMode,
+ inputPath: options.concatenatedTsFilePath,
+ type: 'hls-from-ts' as 'hls-from-ts',
+ isAAC: options.isAAC
+ })