Development Experience

Thursday, December 22, 2011

Play MKV Video in HTML 5 Example

As you know HTML5 can able to play video file...
So this night I spend my time on it and its done :)

Why I tried my chance on MKV because it is very popular :)
Also you have another video format options with HTML5.
MKV was nice solution form me so I this post you will learn how to play the MKV with HTLM5

Here is the code...
You should save it as HTML...
And it works in Google Chrome
and the video was on my desktop...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
 <meta name="author" content="GLDGN" />

 <title>Untitled 1</title>
</head>
<script>
 function failed(e) {
   // video playback failed - show a message saying why
   switch (e.target.error.code) {
     case e.target.error.MEDIA_ERR_ABORTED:
       alert('You aborted the video playback.');
       break;
     case e.target.error.MEDIA_ERR_NETWORK:
       alert('A network error caused the video download to fail part-way.');
       break;
     case e.target.error.MEDIA_ERR_DECODE:
       alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
       break;
     case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
       alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
       break;
     default:
       alert('An unknown error occurred.');
       break;
   }
 }
</script>
<body>

<p><video src="x.mkv" type='video/x-matroska; codecs="theora, vorbis"' autoplay controls onerror="failed(event)" ></video></p>
<p><a href="x.mkv">Download the video file</a>.</p>

</body>
</html>

5 comments:

  1. what about language tracks?
    with *.mp4 works "audioTracks[0].language"
    https://msdn.microsoft.com/en-us/library/windows/apps/hh452774.aspx
    but *.mkv doesn't works
    do you help me please?

    ReplyDelete
  2. How to get Sky Exchange login ID?
    In our official website https://skyexchange.net.in you will see whatsapp icon at the bottom right side.
    You click on this icon, you will see the option of New ID.
    You click on the option of new ID. You will be redirected to whatsapp.
    Here you have to talk to our official member about Betbhai9 ID.
    Then you will be given the payment details. And when you make the payment, then you will be given a username and password.
    Benefits of Sky exchange ID
    Sky Exchange

    ReplyDelete
  3. SEL कंपनी एक vertically integrated textile कंपनी है जो combed yarn, कॉटन यार्न, knitted garments और knitted fabric बनाती है। इसके main प्रोडक्ट में पोलो शर्ट, t-shirt, बॉक्सर शॉर्ट्स, स्वेटशर्ट लड़कियों के टॉप और थर्मल आदि शामिल है। यह कंपनी सभी प्रकार के बुने हुए कपड़ों का मैन्युफैक्चरिंग और एक्सपोर्ट करते हैं। इस company की spinning units इकाइयां knitting कार्यों के लिए इस्तेमाल होने वाले thread के एक हिस्से का production करती है। जबकि शेष domestic और overseas दोनों बाजार में बेचा जाता है। इसी तरह जिस कपड़े को वह manufacturing करते हैं, उसका उपयोग knitted कपड़ों के निर्माण के लिए भी किया जाता है। साथ ही बुने हुए कपड़ों के रूप में local स्तर पर भी बेचा जाता है।

    ReplyDelete