In this article I will explain with an example, how to play (Live Stream) Video Files (MP4) using HTML5 Video Player in ASP.Net.
Video Location
The Video is stored in a folder within the Website project.
HTML Markup
The following HTML Markup consists of an HTML5 Video Player element.
The HTML5 Video Player element has the following properties:
1. id – ID of the Video Player.
2. src – URL of the Video.
3. width – Width of the Video Player.
4. height – Height of the Video Player.
5. controls – If set True, it display the control Buttons such as Play Pause, Volume, etc. in the HTML5 Video Player.
6. loop – If set True, it will keep playing video i.e. once the video is completed, automatically it will start again.
The ResolveUrl function is used to convert the Relative URL to Absolute URL as the HTML5 Video Player requires Absolute URL.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<video id="VideoPlayer" src="<%=ResolveUrl("~/Videos/Butterfly.mp4") %>" controls="true"
width="400" height="350" loop="true" />
</form>
</body>
</html>
Screenshot
Browser Compatibility
* All browser logos displayed above are property of their respective owners.
Demo
Downloads