在基本网页上加载视频,无法正常工作

时间:2014-07-31 03:43:01

标签: javascript html html5 video web

我正在尝试在网页上加载示例视频。我以前从未将计算机上的视频加载到某个页面上。根据w3学校的说法,这应该有效,但它不起作用。

<! DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="videoPageCSS.css">
</head>


<body>
<div class id= videoContainer>
<embed src="test.mp4" width="200" height="200">
</div>
<div class id= description>
<p>A sample video that will not go to full screen on IOS phone</p>
</div>
</body>
</html>

由于

1 个答案:

答案 0 :(得分:0)

<embed src="test.mp4" width="200" height="200">

上面的代码是错误的。

在下面试试

<video autoplay height="400" width="300">
  <source src="test.mp4" type="video/mp4">
  <source src="test.ogg" type="video/ogg"> <!-- even though you don't have ogg video file,    
I reccomend you make a copy of your mp4 and convert it to ogg so that you video ca run on   
all major browsers and be cross-browser compatible. -->
</video>

您也不需要在html5 doctype声明中在感叹号和DOCTYPE之间创建空格(