Use the HTML5
<video>
and
<audio>
elements:
Using HTML5 audio and video - Web developer guides | MDN[
^]
You'll need to make sure you have the relevant formats required to support different browsers:
Media formats supported by the HTML audio and video elements - HTML | MDN[
^]
To load the video / audio file, you'll need an action which returns the file data:
public ActionResult Video(int id)
{
var videoData = ...;
return File(videoData, "video/mp4");
}
<video controls autoplay>
<source src="@Url.Action("Video", "YourController", new { id = Model.VideoId })" type="video/mp4" />
(Fallback content for old browsers...)
</video>