How to playback MKV video in web browser?

前端 未结 5 1742
青春惊慌失措
青春惊慌失措 2020-12-15 04:43

I am trying to make a MKV video with a MPEG4 video codec and AC3 audio codec available to be played online using Mozilla or Chrome. I have tried multiple methods including n

相关标签:
5条回答
  • 2020-12-15 05:19

    HTML5 and the VLC web plugin were a no go for me but I was able to get this work using the following setup:

    DivX Web Player (NPAPI browsers only)

    AC3 Audio Decoder

    And here is the HTML:

    <embed id="divxplayer" type="video/divx" width="1024" height="768" 
    src ="path_to_file" autoPlay=\"true\" 
    pluginspage=\"http://go.divx.com/plugin/download/\"></embed>
    

    The DivX player seems to allow for a much wider array of video and audio options than the native HTML5, so far I am very impressed by it.

    0 讨论(0)
  • 2020-12-15 05:20
    <video controls width=800 autoplay>
        <source src="file path here">
    </video>
    

    This will display the video (.mkv) using Google Chrome browser only.

    0 讨论(0)
  • 2020-12-15 05:21

    You can use this following code. work just on chrome browser.

     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;
       }
     }
     <!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="Amin Developer!" />
    
     <title>Untitled 1</title>
    </head>
    <body>
    
    <p><video src="http://jell.yfish.us/media/Jellyfish-3-Mbps.mkv" type='video/x-matroska; codecs="theora, vorbis"' autoplay controls onerror="failed(event)" ></video></p>
    <p><a href="YOU mkv FILE LINK GOES HERE TO DOWNLOAD">Download the video file</a>.</p>
    
    </body>
    </html>

    0 讨论(0)
  • 2020-12-15 05:34

    To use video extensions that are MKV. You should use video, not source

    For example :

      <!-- mkv -->
      <video width="320" height="240" controls src="assets/animation.mkv"></video>
    <!-- mp4 -->
      <video width="320" height="240" controls>
        <source src="assets/animation.mp4" type="video/mp4" />
      </video>
    My answer may be incomprehensible to you, so if you do not understand, click on this

    0 讨论(0)
  • 2020-12-15 05:36

    HTML5 does not support .mkv / Matroska files but you can use this code...

    <video>
        <source src="video.mkv" type="video/mp4">
    </video>
    

    But it depends on the browser as to whether it will play or not. This method is known to work with Chrome.

    0 讨论(0)
提交回复
热议问题