简体   繁体   English

MediaElement.Position行为和Windows Phone 7问题

[英]MediaElement.Position behaviour and Windows Phone 7 issue

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. 我有一个问题,我为Windows Phone 7编写了一个简单的Media Player,可以播放,停止和控制视频的音量(从URI加载),但是当我尝试设置位置时,这会导致应用程序冻结。 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. 并尝试使用Seconds值,转换为Ints等,但是每次我尝试设置Position时,应用程序都会冻结。 The video otherwise plays normally - anyone know what the problem may be here? 视频否则会正常播放-有人知道问题出在哪里吗?

I've posted the link to the answer I provided for you on the Windows Phone Developer Forums so that the community on StackOverflow may find it as well: 我已经在Windows Phone开发者论坛上发布了我为您提供的答案的链接,以便StackOverflow上的社区也可以找到它:

http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/db82a416-8153-436d-99c6-5affd03148ce http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/db82a416-8153-436d-99c6-5affd03148ce

Regards, 问候,

Richard. 理查德。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM