This question is about a asp.net WEB Application and not about .net windows application. In my application I am uploading video files (mp4) using asp.net core.
I need to get metadata from this video file, but for now I am focusing on the duration of this video file.
I have created the form and in my controller I am successfully receiving an IFormFile file
object. I can find the size the file by just calling the .length method ( file.Length
) but I am really struggling to get the exact date and especially the duration of this object.
How can I determine the exact date and the duration of this object?
This is my code:
public async Task UploadVideos(IList<IFormFile> files)
{
long size = files.Sum(f => f.Length);
Console.WriteLine("The size of all the selected files is:"+size);
Console.WriteLine("the file name is" + files[0].FileName);
string type = files[0].ContentType;
if (type.Equals("video/mp4"))
{
Console.WriteLine("Indeed a mp4 format");
}
}