Skip to content

Commit

Permalink
#54 mp3とwavでtotaltimeが変わることへの対処
Browse files Browse the repository at this point in the history
  • Loading branch information
aiueo-1234 committed May 3, 2024
1 parent 274fc3d commit 749863e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Epub/KoeBook.Epub/Services/EpubGenerateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public async ValueTask<string> GenerateEpubAsync(BookScripts bookScripts, string
using var reader = new WaveFileReader(ms);
var tmpMp3Path = Path.Combine(tempDirectory, $"{document.Title}{i}.mp3");
MediaFoundationEncoder.EncodeToMp3(reader, tmpMp3Path);
scriptLine.Audio = new Audio(reader.TotalTime, tmpMp3Path);
using var mp3Stream = new Mp3FileReader(tmpMp3Path);
scriptLine.Audio = new Audio(mp3Stream.TotalTime, tmpMp3Path);
}

if (await _createService.TryCreateEpubAsync(document, tempDirectory, cancellationToken).ConfigureAwait(false))
Expand Down

0 comments on commit 749863e

Please sign in to comment.