阿帕奇+ HTML5 视频标签 - 可能会出现什么问题?
【查看更新! - 适用于 Android/IOS 浏览器,但不适用于其他地方。 FireFox、Chrome、Opera、Safari 都失败。尽管它们肯定已准备好 HTML5 视频标签]
只是尝试使用 html5 标签流式传输视频。我得到的只是视频播放器控件,没有其他任何东西。这太简单了,我认为它应该可以工作:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Movie title</title>
</head>
<body>
<video id="movie" preload controls>
<source src="test.mp4" />
</video>
</body>
那么我哪里可能会出错呢?我已经尝试了比这个小片段更多的尝试。我尝试过其他人的示例片段。我尝试过很多视频、很多格式(mp4、flv、ogg)。我尝试在 Chrome、Firefox、Android 嵌入式浏览器、Opera、IE9 中查看它。
我可以在 VLC 等程序中从 URL 流式传输文件,没有任何问题。
我开始认为 Apache2 可能是这里的问题,尽管我认为我可以毫无问题地从 VLC 流式传输 URL,这表明 Apache2 不是问题。
任何帮助表示赞赏。我在这里拉头发。
更新:
每当我尝试从 Chrome 中访问视频目录的 URL 时,似乎都会出现此错误:资源解释为其他,但以未定义的 MIME 类型传输
该错误绝对是服务器端问题,apache2 不得在某处正确配置?
如果我从 Apache2 服务器中的 URL 访问 FLV 文件目录,则会出现此 MIME 类型未定义错误。它是视频控制。每当我单击“播放”时,它都会多次发送未定义的 MIME 类型的垃圾邮件。
更新2:
验证我的.htaccess正在被读取
将以下内容添加到我的.htaccess:
AddType 视频/ogg .ogv
AddType 视频/ogg .ogg
AddType video/mp4 .mp4
仍然不起作用,仍然看到 MIME Chrome 中的 TYPE UNDEFINED。
Update3:
- Firefox 和其他浏览器可以毫无问题地查看 URL/test.mp4,但没有一个可以使视频标签正常工作。
Update4:
- Android 现在可以让视频标签工作了。 .htaccess 的更改似乎解决了这个问题。然而,无论出于何种原因,没有任何一个桌面浏览器可以做到这一点。
[See the updates! - Works on Android/IOS browsers but no where else. FireFox, Chrome, Opera, Safari all fail. Even though they are definitely HTML5 video tag ready]
Simply trying to stream a video using html5 tag. All I get is the video player controls and nothing else. This is so simple I assumed it should just work:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Movie title</title>
</head>
<body>
<video id="movie" preload controls>
<source src="test.mp4" />
</video>
</body>
So where could I be going wrong? I've tried a lot more than this small snippet. I've tried other peoples example snippets. I've tried many videos, many formats (mp4, flv, ogg). I've tried viewing it in Chrome, Firefox, Android Embedded browser, Opera, IE9.
I can stream the file from the URL in programs like VLC without any issues.
I am beginning to think Apache2 might be the issue here although I figure the fact I can stream the URL from VLC without issue would suggest Apache2 is not the problem.
Any help appreciated. I'm pulling on hair here.
Update:
Whenever I try and access the URL of the video directory from within Chrome it seems to give me this error: Resource interpreted as Other but transferred with MIME type undefined
That error is definitely a server side problem, apache2 must not be configured properly somewhere?
If I access even a FLV file directory from the URL within my Apache2 server it gives this MIME type undefined error. It the video controls. Whenever I click play it spams the MIME type undefined a few times.
Update2:
Verified my .htaccess is being read
Added the following to my .htaccess:
AddType video/ogg .ogv
AddType video/ogg .ogg
AddType video/mp4 .mp4
Still not working, still see the MIME TYPE UNDEFINED in Chrome.
Update3:
- Firefox and others can view the URL/test.mp4 without issue but NONE can get the video tag to work properly.
Update4:
- Android can get the video tag to work now. The .htaccess change seemed to fix that. However not one single desktop browser can for whatever reason.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Firefox 和 Opera 不支持 MP4,Chrome 很快就会放弃对它的支持。添加 WebM 源也是个好主意。
尝试将
type
属性添加到source
声明中:Firefox and Opera don't support MP4, and Chrome will drop support for it soon. It's a good idea to also add a WebM source.
Try adding the
type
attribute to thesource
declaration:这是我的网站 www.pi-corp.net 上的 html 代码。这允许在所有商业浏览器上播放并回退到 Flash。
Here is my html code from my site www.pi-corp.net. This allows for playback on all commercial browsers with fallback to flash.