MVC 4 HTML 5 Video Control

Download video: MP4 format | WebM format | Ogg format

Big Buck Bunny HTML 5 Video

The HTML5 draft specification introduced the video element for the purpose of playing videos or movies, Many modern websites show videos. HTML5 provides a standard for showing them.

 Setup
@Html.Video(new VideoOptions()
{
    Mp4Url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4",
    WebmUrl = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm",
    OggUrl = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv",
    PosterUrl = "http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg",
    HasPoster = true,
    HasDownloadLink = true,
    VideoNotSupported = "<p>No video playback capabilities, please download the video below</p>",
    TrackEnable = true,
    Track = new List<Track>() { new Track() { Src = "Content/audio/captions.vtt" } }
}, new { @class = "video-responsive", id = "video1" })
            
Notes
Don't forget to add namesapace in web.config under <namespaces> tag.
<add namespace="MVCVideo" />

MVC 4 HTML 5 Audio Control

Download audio: MP3 format | Ogg format | Wav format

HTML5 provides a quick and easy way to add audio files to be played on a website. Using the audio element an audio clip can be added to a page. An audio element also needs a source URL specified via the src attribute.
 Setup
@Html.Audio(new AudioOptions()
{
    Mp3Url = "Content/audio/jazz.mp3",
    OggUrl = "Content/audio/jazz.ogg",
    WavUrl = "Content/audio/jazz.wav",
    AudioNotSupported = "<p>This browser does not support the audio.</p>",
    HasDownloadLink = true
}, new { @class = "audio", id = "audio1" })
                
nuget package
PM> Install-Package MVC4.Video