/// <summary> /// Method to calculate video length /// </summary> /// <param name="videoPath"></param> public void VideoTimeSpan(string videoPath) { var player = new WindowsMediaPlayer(); var clip = player.newMedia(videoPath); Times = (int)clip.duration; }
public MediaFacade(string fileName) { wmp = new WindowsMediaPlayer(); wmp.settings.autoStart = playing; IsLooping = false; wmp.settings.setMode("autoRewind", true); wmp.PlayStateChange += Wmp_PlayStateChange; var media = wmp.newMedia(fileName); if (0.0 == media.duration) throw new Exception("Could not load file '" + fileName + "'"); length = (float)media.duration; wmp.URL = fileName; }
public string getAlbum(string file) { string result; WindowsMediaPlayer wmp = new WindowsMediaPlayer(); IWMPMedia mediainfo = wmp.newMedia(file); result = mediainfo.getItemInfo("Album"); return result; }
public string getDuration(String file) { string result; WindowsMediaPlayer wmp = new WindowsMediaPlayer(); IWMPMedia mediainfo = wmp.newMedia(file); var timespan = TimeSpan.FromSeconds(mediainfo.duration); result = timespan.ToString(@"hh\:mm\:ss"); return result; }