What is best way to get?
I have a field where user will upload video.
When you click the upload button, Video get uploaded. This work perfectly.
I needed the duration of the video from physical path, I tried:
using WMPLib;
WindowsMediaPlayer wmp = new WindowsMediaPlayerClass();
IWMPMedia mediaInfo = wmp.newMedia(Server.MapPath("~/Uploads/test.mp4"));
double duration = mediaInfo.duration;
But its not working, I get error:
The type 'WMPLib.WindowsMediaPlayerClass' has no constructors defined Interop type 'WMPLib.WindowsMediaPlayerClass' cannot be embedded.
How to catch the duration?