Question

I am working on retrieving data from a .mp4 file using the Shell32 library.

The code I have works on localhost, but when I use it on a IIS server it returns the file as a "MP4 File" instead of a "MP4 Video" which results in no video data (Width, height, frame rate, etc.) getting back.

I read that I could use GetDetailsEx to get the correct data back, but this method doesn't seem to exist in the Folder class.

public static ExtendedFilePropertiesMp4 GetExtendedFileProperties(string directory, string fileName)
    {
        Dictionary<string, int> headers = new Dictionary<string,int>();

        Shell shell = new Shell();
        Folder folder;

        folder = shell.NameSpace(directory);

        for (int i = 0; i < short.MaxValue; i++)
        {
            string header = folder.GetDetailsOf(null, i);

            if (String.IsNullOrEmpty(header))
                break;

            if (!headers.ContainsKey(header))
                headers.Add(header, i);
        }

        FolderItems folderItems = folder.Items();

        foreach (FolderItem2 item in folder.Items())
        {
            if (folder.GetDetailsOf(item, 0) == fileName)
            {
                ExtendedFilePropertiesMp4 extendedFileProperties = new ExtendedFilePropertiesMp4();

                // Get data and set the properties of the extendFileProperties

                return extendedFileProperties;
            }
        }

        return null;
    }

Is there a setting in the Web.config or similar I need to change for it to work?

EDIT: I see I have been down voted, could the people that did it explain why? I'd love to elaborate on my problem

Was it helpful?

Solution

What I was using this for was to change the width and height of a div tag that had a video tag inside of it.

Since the above didn't work I found another way of doing it, which was by using the loadedmetadata.

For more information see this answer: jQuery, checking to see if video has height/width

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top