user6283344
user6283344

Reputation:

How to Configure IIS Express for mp4 videos

I have written an application using C# ASP.Net MVC which in its Home View lists all folders of a Directory in a table. Each tr has a single td and td contains a. Clicking on a (folder name) replaces a div of Home View with a partial view which in turn lists all mp4 videos along with duration of that folder in similar way and I have used jQuery AJAX for such replacement. By clicking on VideoName video gets played and I have used video tag and specified type="video/mp4".

I have added a Website in IIS Server where hostname is tutorials.com, physical path is App path and in binding I have used 192.168.1.3 : 80. In DNS Server I have created a Primary Zone named tutorials.com and in a record used the same IP. I can watch video tutorials from any PC of my local network without any issue.

If I open the application in Visual Studio and press F5 or Ctrl+F5 it starts using IIS Express and when I click on Videoname some videos are rendered properly and some do not. How to configure IIS Express to solve the problem?

Upvotes: 0

Views: 5483

Answers (4)

Gergo
Gergo

Reputation: 135

I have the same issue- some MP4 clips work and some not. Server is IIS Express on Windows 10. Tested different clients. The clips can be saved from all clients- no issues. On other server (Apache) the clips work fine. Although the clips appear not to be working, they actually do (at least on some systems). But they are not streamed (fragments/ranges are not treated as separate). They have to be completely transferred and than they start to play. Chrome on small ARM Linux- they simply do not work. Chrome or Edge on Intel Win 10- they are transferred and than they play. For bigger clips it might take a while. On Apache the same clips (with issues on IIS) work fine no matter the client. So in my opinion there are several options- change server, change client or save the clips and than watch them. Another option might be to change the clips. Have not played with this one, but changing key frames and frame rate might also help in some situations.

Upvotes: 1

Zoltán Tamási
Zoltán Tamási

Reputation: 12809

Before configuring the mappings, you have to remove the existing ones too. I use a configuration like this in my web.config file.

<system.webServer>
  <staticContent>
    <remove fileExtension=".mp4"/>
    <mimeMap fileExtension=".mp4" mimeType="video/mp4"/>
    <remove fileExtension=".ogv"/>
    <mimeMap fileExtension=".ogv" mimeType="video/ogg"/>
    <remove fileExtension=".m4v"/>
    <mimeMap fileExtension=".m4v" mimeType="video/m4v"/>
    <remove fileExtension=".webm"/>
    <mimeMap fileExtension=".webm" mimeType="video/webm"/>
  </staticContent>
</system.webServer>

Upvotes: 2

StackUseR
StackUseR

Reputation: 958

Navigate to your IIS Express directory in prompt and do this appcmd set config /section:staticContent /+[fileExtension='.mp4',mimeType='vieo/mp4']

As suggested by Dani, if the problem is with the web page than I hope you should add <meta http-equiv-"X-UA-Compatible" content="IE=edge"/> to the <head> block of a webpage for testing as mentioned in How to use HTML5 to play video files on your webpage.

Upvotes: 0

Sathishkumar
Sathishkumar

Reputation: 429

Add Following XML Code in the WebConfig.xml file.

 <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
      <mimeMap fileExtension=".webm" mimeType="video/webm" />
      <mimeMap fileExtension=".ogv" mimeType="video/ogv" />
    </staticContent>
  </system.webServer>

The Above Lines allow the MIME Types.

Upvotes: 2

Related Questions