I have a website that has a video background on it's homepage. The video get's fetched from the folder 'videowall'. The live version of the site doesn't play the video and I get 'Failed to load resource: the server responded with a status of 404 (Not Found)' in the developer tools window. I checked the root folder of the FTP server and the folder was there.
The portion of the code that plays the video :
<video preload="auto" autoplay="autoplay" loop="loop" volume="0" poster="~/video/oranges.jpg" muted="muted">
<source src="/videowall/pete.mp4" type="video/mp4" />
<%--<source src="~/video/oranges.webm" type="video/webm" />--%>
<source src="/videowall/pete.ogv" type="video/ogg" />
</video>
The path of the file is relative to the root directory. Why is the FTP server not able to find it?
you need to add a custom mime type in the web.config to serve the mp4 file.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
</system.webServer>
</configuration>
You can reference the following links:
https://social.msdn.microsoft.com/Forums/azure/en-US/79eb0c22-fe78-41d6-ac57-03055610b2a8/mp4-media-files-on-azure-website?forum=windowsazurewebsitespreview&prof=required
http://www.iis.net/configreference/system.webserver/staticcontent/mimemap
Related
I have added the html 5 video tag in my web page. The video is running (locally) on an IIS server which is the hosting machine. But when I run through the domain name it's not running (outside of IIS).
Folder permission is also given, but it runs from IIS Local.
I added the mime type on the IIS server.
var video = document.getElementById('videotag');
video.src = '../Images/Videos/example.webm';
video.play();
There is only a single way to do this currently. If your type of video is MP4 running on IIS/.NET
Add a web.config file to the root of the application wwwroot\web.config with the following contents
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="application/mp4" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
</configuration>
I have one more question about IIS compression
I have static file ../wwwroot/src/locale/en-us.json and sgv
But IIS8.5 recognizes it as a dynamic content and try to use dynamic compression
What I must do to force IIS works with .json and .svg in the same way like .js and .css
The issue was in mime types, by default IIS doesn't apply dynamic compression for application/json and xml/svg+xml
I don't have access to web server configuration and I made a workaround in local web.config
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="text/json" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="text/svg+xml" />
</staticContent>
ITo download updates for a game, I've configured IIS 7.5 to download any type of file such as .html, .xml, .aspx etc. But there is one problem.
I am not able to download the files of type .map, .browser, .config. Actually these are files related to game. Without these files the update doesn't complete.
Can you please help me in solving these issues.
You need to add MIME types for these extensions.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".config" mimeType="text/xml" />
<mimeMap fileExtension=".map" mimeType="text/plain" />
<mimeMap fileExtension=".browser" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
On side note making these file available to client may cause serious security threat.
When I am requesting the json file using ajax from dotnet application I got this error:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Please share the solution
Implement below code in `web.config` file. Use the file extension that you want to fetch
For Example: here is .json file
<system.webServer>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
I am using in my .aspx file the following code:
<video controls="controls" >
<source src="movie.mp4" type='video/mp4'>
<source src="movie.ogv" type='video/ogg; codecs="theora, vorbis"' />
<source src="movie.webm" type='video/webm'>
</video>
in web.config I placed:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".m4v" mimeType="video/m4v" />
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
</staticContent>
</system.webServer>
...
In FF22 the mp4 movie is displayed in the correct way, but in IE10 I get the error 'Invalid source'. If I create a basic HTML file with the same 'video' tag, I can view the video also in IE10 (with file: protocol). For some reason the filetype in IE10 for the MP4 file is always 'application/octet-stream', instead of 'video/mp4' as specified in the web.config.
Any ideas why this happens?
sApparently you can't override this in a location tag or even in your web.config like so:
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/x-font-woff" />
<remove fileExtension="ogg"/>
<remove fileExtension="mp4"/>
<remove fileExtension="webm"/>
<mimeMap fileExtension="ogg" mimeType="video/ogg" />
<mimeMap fileExtension="webm" mimeType="video/webm" />
<mimeMap fileExtension="mp4" mimeType="video/mp4" />
</staticContent>
Instead, I had to add .mp4 under mime types in the GUI (this doesn't appear to have altered web.config at all) as a local definition:
Confirmed with fiddler, the .mp4 is now served with a content type of video/mp4 (even though the staticContent tag was defined previously)