How i get duration at mvc-4 ??
i read all of posts , but i cant add some of dlls and some of dlls do not work .
now i am using:
from
Microsoft.WindowsAPICodePack.Shell
and
Microsoft.WindowsAPICodePack.Shell.PropertySystem
these namespace get me just duration of mp-3 . but do not get duration *.flv. This code is for mp3 :
using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
public static double Convert100NanosecondsToMilliseconds(double nanoseconds)
{
return nanoseconds * 0.0001;
}
below code is in my action :
var fle = "Path of mp3";
ShellFile so = ShellFile.FromFilePath(fle);
double nanoseconds;
double.TryParse(so.Properties.System.Media.Duration.Value.ToString(), out nanoseconds);
if (nanoseconds > 0 )
{
double seconds = Convert100NanosecondsToMilliseconds(nanoseconds) / 1000;
double time = Math.Round(seconds / 60, 1);
string res = time.ToString();
}
my visual studio is 2013 .
my windows is 8 .