I have a MediaElement that reports its position incorrectly and strangely, but consistently. It seems that when he gets to the last second of the sound (and he always at the last second, regardless of whether it sounds two seconds or 10), he does not update the position until it ends.
Output Example:
Play Progress: 0 / 3.99 - 0 Play
Progress: 0.01 / 3.99 - 0 Playback
Progress: 0.03 / 3.99 - 0 Playback
Progress: 0.06 / 3.99 - 1 Play
Progress: 0.07 / 3.99 - 1 Play
Progress: 0.08 / 3.99 - 2 Playback
Progress: 0.11 / 3.99 - 2 Play
Progress: 0.14 / 3.99 - 3 Play
Progress: 0.19 / 3.99 - 4 Playback
Progress: 0.23 / 3.99 - 5 Play
Progress: 0.25 / 3.99 - 6 Play
: 0,28/3,99 - 7
: 0,3/3,99 - 7
[]
: 2.8/3.99 - 70
: 2.83/3.99 - 70
: 2.88/3.99 - 72
: 2.9/3.99 - 72
: 2.91/3.99 - 72
: 2.92/3.99 - 73
: 2.99/3.99 - 74
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3/3,99 - 75
: 3,99/3,99 - 100
:
WriteLine("Playback Progress: " + Position + "/" + LengthInSeconds + " - " + (int)((Position / LengthInSeconds) * 100));
public double Position
{
get
{
return my_media_element != null ? my_media_element.Position.TotalSeconds : 0;
}
}
public double LengthInSeconds
{
get
{
return my_media_element != null ? my_media_element.NaturalDuration.TimeSpan.TotalSeconds : 0;
}
}
- , ?