Live streaming via HTML5 video


  • I want to develop an HTML5 based IE9 client that is capable of playing the continous video stream from my web service.  The format of the video stream from my web service will be H.264 encoded in a mpeg-ts stream.  As a quick test, I tried to use the HTML5 video tag to display a local file that I had generated using the following:


     <video width="640" height="480" controls="controls">
       <source src="c:\tmp\videofile.ts" type="video/mp2t" />
     Your browser does not support the video tag.


    Unfortunately this does not seem to work.  I am able to play this same videofile.ts file in other players such as Windows Media Player so I am pretty sure the file is OK.  So I am wondering whether the mpeg-ts format is supported by the HTML5 video element in IE9?  If not, any other suggestions for what could be used?



    2012년 3월 12일 월요일 오전 4:19

모든 응답

  • web pages can only access the local file system with the file: protocol

    scr="tmp\videofile.mp4" will work if tmp is a subfolder where your html5 document is....

    the mp4 file extension is required for your local web server too send back the correct mime type. there is an IE security zone setting for use mime-sniffing.

    To run local web pages you need

    Tools>Internet Options>

    Security tab, click "Reset all zones to default"

    Advanced tab, check "Run active content in files on My Computer*" (IE restart required for changes to take affect) or Add the MOTW (mark of the web) to your page.



    2012년 3월 12일 월요일 오전 5:18
  • I should have provided a little more detail ... if I use an "mp4" instead of a "ts" file then I am able to display the video on the web page fine so it is not an issue of accessing the local file system.  The problem only happens when I try to use the mpeg-ts file "videofile.ts" instead of the mp4 version of the file which makes me wonder whether mpeg-ts is in fact supported by the HTML5 video element.  Also note that the mime type is specified in the 'type' attribute for the source so I am not sure what you mean by "mime sniffing".  Now it is entirely possible that I am not specifying the right mime type "video/mp2t" so I am hoping that someone can answer the two questions for me:

    - Does HTML5 video support mpeg-ts

    - What is the right mime type to specify for mpeg-ts



    2012년 3월 12일 월요일 오후 2:51
  • have you searched for an answer in the public domain? Please provide a link to your website or mashup for us to debug... we cannot test your snippet.



    2012년 3월 12일 월요일 오후 8:06