NAudio is freezing on one specific mp3 file. All other files play ok. This same mp3 file plays fine in Windows Media Player. However, in NAudio, this one specific file freezes towards the end of the file. I have tried two versions of NAudio : 1.7.3 and 1.8.0 (latest) and both have the same freezing issue. I can provide the MP3 file for developer testing. Thank you.
Comments: Thanks. It looks like it is something that should be corrected. I was able to do a workaround with your suggestion by also checking if playbackstate is stopped as you mentioned: private bool endOfStream() { try { // To check for end of file, check stream position // In addition, also check PlaybackState // Since NAudio does not accurately work out how far through we are, probably due to changes to bitrate if (fileWaveStream.Position >= fileWaveStream.Length || waveOut.PlaybackState == PlaybackState.Stopped) { return true; } else { return false; } } catch (Exception ex) { return true; // if we have an error mark as end of stream true } }
Comments: Thanks. It looks like it is something that should be corrected. I was able to do a workaround with your suggestion by also checking if playbackstate is stopped as you mentioned: private bool endOfStream() { try { // To check for end of file, check stream position // In addition, also check PlaybackState // Since NAudio does not accurately work out how far through we are, probably due to changes to bitrate if (fileWaveStream.Position >= fileWaveStream.Length || waveOut.PlaybackState == PlaybackState.Stopped) { return true; } else { return false; } } catch (Exception ex) { return true; // if we have an error mark as end of stream true } }