This project has moved and is read-only. For the latest updates, please go here.

ArgumentOutOfRangeException on audioFileReader.CurrentTime.TotalMilliseconds occured

Oct 8, 2014 at 12:58 PM
I have a strange ArgumentOutOfRangeException when using the AudioFileReader and try to get the TotalMilliseconds when iam at the end of the file.

(my file is{00:02:49.6910000} min/sec/ms long )

I have the following:
var currentPlayTime = audioFileReader.CurrentTime.TotalMilliseconds;
where my audioFileReader has the following properties:
Length = 59867136
__Position = 59867136__
Now I got the Exception with the following information:
{"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}

at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at NAudio.Wave.Mp3FileReader.get_Position()
at NAudio.Wave.AudioFileReader.get_Position()
at NAudio.Wave.WaveStream.get_CurrentTime()
at AudioTransmission.Execute(CancellationToken ct) in c:\Projects\TEST\AudioTransmission.cs:line 185

It seems that the exception is thrown when we are at the end of the file and we try to get the currenttime of the audiofile ...


any help is really appreciated ..
thanks in advance

Iam using the NAudio version 1.7.1.17 (From NuGet)...