Fix: HTML5 Video not playing when deployed to azure

The HTML5 video added in the webpage was playbacking successfully in my developer environment. But, why deployed to client's Azure web app it was not playing at all. I suspected for any script errors but browser's console window was empty. Later I figured out that we need to specify mime type in web.config of the website for this to work.

Below is a quick peek of web.config file.

<configuration>
	<system.webServer>
		<staticContent>
			<remove fileExtension=".mp4" />
			<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
			<remove fileExtension=".webm" />
			<mimeMap fileExtension=".webm" mimeType="video/webm" />
			<!-- Add your mime type here -->
		</staticContent>
	</system.webServer>
</configuration>



 

Hope this helps.