MediaElement.Position behaviour and Windows Phone 7 issue

Posted by RoguePlanetoid on Stack Overflow See other posts from Stack Overflow or by RoguePlanetoid
Published on 2010-04-26T09:47:54Z Indexed on 2010/05/05 7:48 UTC
Read the original article Hit count: 568

I have a problem, I have written a simple Media Player for Windows Phone 7 and can Play, Stop and control the Volume of a Video (loaded from a URI) however when I try to set the position, this causes the application to freeze. I have used both these lines, but either does not work:

        Player.Position = new TimeSpan(0, 0, 0, 0, (int)Position.Value);

        Player.Position = TimeSpan.FromSeconds((int)(Position.Value));

I do have this event handler:

    void Player_MediaOpened(object sender, RoutedEventArgs e)
    {
        Position.Maximum = Player.NaturalDuration.TimeSpan.TotalMilliseconds;
    }

And have tried using the Seconds value, casting to Ints etc, however everytime I try to set the Position, the app freezes. The video otherwise plays normally - anyone know what the problem may be here?

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-phone-7