I want 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??.
A:
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.
Shoaib Shaikh
2010-05-05 06:38:57