嵌入mp4视频的问题 [英] Problems embedding mp4 video
问题描述
我试图使用html5视频标签嵌入mp4,但我遇到了一些在不同浏览器中出现的问题。
I'm trying to use the html5 video tag to embed an mp4 but I'm having some issues that vary across different browsers.
我的代码看起来像这样:
My code looks like this:
<video controls="controls" width="640" height="360">
<source src="http://www.mydomain.com/video.mp4" type="video/mp4" />
</video>
IE - 尝试嵌入时无法识别文件(编辑:IE实际上正在拖动文件大小不是格式),当我的视频的uri被插入到地址栏时,它会在windows media player中打开视频。
IE - Won't recognize the file when trying to embed (edit: IE was actually dragging on the file size not the format) and when the uri to my video is plugged into the address bar it opens the video in windows media player.
Chrome,Firefox - 根本不会认识到文件格式(编辑:Firefox拖动大小,Chrome是唯一有问题的浏览器),当uri插入地址栏时,它尝试在浏览器中播放视频,但失败。
Chrome, Firefox - Simply will not recognized the file format (edit: Firefox was dragging on the size as well, Chrome was the only browser having issues) and when the uri is plugged into the address bar it attempts to play the video within the browser but fails.
文件中是否有可能阻止其被嵌入的内容?如果是这样,我怎么能找到这个?
Could there be something within the file that would prevent it from being embedded? If so, how can I find this out?
推荐答案
问题可能是浏览器不支持MP4,因为它是专有格式。要获得最佳的跨浏览器支持,您还必须使用WebM和Ogg / Vorbis格式对视频进行编码,然后将这些文件添加到 source
标签。
The problem is likely that the browsers are not supporting MP4, because it is a proprietary format. To get the best cross-browser support you'll have to also encode your video in WebM and Ogg/Vorbis formats and then add those files to your video
tag with their own source
tags.
如果您直接导航到视频的网址,浏览器将播放视频并不意味着浏览器支持该格式。通常,直接导航到视频会导致浏览器使用诸如Quicktime或VLC等插件播放视频,这些插件比浏览器支持的编解码器要好得多。
Just because a browser will play a video if you navigate directly to the video's URL does not mean that the browser supports that format. Usually, navigating straight to the video causes the browser to play the video with a plug-in such as Quicktime or VLC that has much better codec support than the browser does.
这篇关于嵌入mp4视频的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!