无法在Google Chrome上播放视频

时间:2014-02-28 04:12:11

标签: javascript html video

我正在尝试使用视频代码和嵌入代码播放视频,但未能在谷歌浏览器上播放,而它应该已经完成​​。

以下是我在每个浏览器上播放的代码:

 <!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">
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <meta http-equiv="X-UA-Compatible" content="requiresActiveX=true"/>
   <title>Live Video Streaming</title>
   </head>
   <body>
    <video id="video1" width="640" height="360" controls>
    <source src="videoplayback.mp4" type="video/mp4">

   <object width="640" height="360" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
     <param name="SRC" value="videoplayback.mp4">
     <p>Please update your browser or install Flash</p>

    <!--<embed  src="videoplayback.mp4"  
    width="640" height="360" type='video/mp4' controls>
        </embed>-->
       </object>
     </video>
     </body>
     </html>

请帮帮我.....谢谢!

2 个答案:

答案 0 :(得分:0)

根据您的说法,它可能是源问题或视频类型。 您必须为Chrome提供额外的编码才能正常工作(例如,此示例也来自MDN):

<video controls>  
  <source src="somevideo.webm" type="video/webm">  
  <source src="somevideo.mp4" type="video/mp4">  
  I'm sorry; your browser doesn't support HTML5 video.  
  <!-- You can embed a Flash player here, to play your mp4 video in older browseres -->  
</video>  

答案 1 :(得分:0)

正确设置视频源文件路径。有时ppl使用src =“./ videos-filename”或绝对路径可以提及