开发者

How to display Total Time Duration and Current Time of video

I w开发者_Python百科ant to display time duration of a video in silverlight 3.0 application. The format should be like 00:20 / 05:00 . ( Current Video time / Total Video Time). How to get it??.


    TimeSpan _duration = mediaElement.NaturalDuration.TimeSpan;
    var totalTime = string.Format("{0:00}:{1:00}", (_duration.Hours * 60) + _duration.Minutes, _duration.Seconds);

    TimeSpan remaining = _duration.Subtract(mediaElement.Position);
    var currentTime = string.Format("{0:00}:{1:00}", (remaining.Hours * 60) + remaining.Minutes, remaining.Seconds);

     string result = string.formar("{0}/{1}",totalTime,currentTime);

Try this, Hope this can help.

Regards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜