1

I just want to practice by editing an html file on my local computer with image and video (ogv) files in the same local directory, but when I try to open a browser (latest version of Firefox) on the html file, it complains "No video with supported format and MIME type found". As I've been reading on the Internet, most of the solutions say to modify the .htaccess file. So is there no way at all to embed videos in an html file just on my computer (not running a web server) and get it to work?

Edit: What I have:

<video width="320" height="240" controls="controls">
  <source src="media/gizmo.ogv" type="video/ogv" />
</video>

Another edit: OK, it works on my local machine if I take off the type="video/ogv" so I guess I'll leave that out of the source tags while I'm working on my local machine and put it back in and do the .htaccess stuff if I ever actually put something on a web server.

4

1 回答 1

2

在视频标签的源标签中使用

type="video/ogg" 

那应该行得通。

最好如下所示

<video width="320" height="240" controls="controls">
  <source src="media/gizmo.mp4" type="video/mp4" />
  <source src="media/gizmo.webm" type="video/webm" />
  <source src="media/gizmo.ogv" type="video/ogg" />
  Your browser does not support this video
</video>

对于不支持该video标签的旧浏览器,它将显示一条消息。提供了不同的视频格式,因为并非所有浏览器都支持所有格式。

附加:如果您要使用网络服务器,请确保网络服务器也支持这些 mimetypes

于 2012-08-08T18:16:32.803 回答