为什么Safari无法播放没有< video>扩展名的文件? [英] Why won't Safari play file without extension in <video>?
问题描述
我有一个名为52bbb58c的文件,没有文件扩展名,它是mp4视频.
I have file named 52bbb58c without file extension and it is mp4 video.
当我尝试将其作为&<source>
添加到具有属性类型(video/mp4)的<video>
时,它无法播放.
When I try to add it as &<source>
to <video>
with attribute type (video/mp4), it doesn't play.
此功能可在Chrome和Firefox上正常工作.如何为Safari修复它?
This works on Chrome and Firefox working. How do I fix it for Safari?
推荐答案
在播放流媒体(例如视频和音频)时,Safari非常繁琐.它具有以下要求
Safari is extremely fussy when it comes to playback of streamed media such as video and audio. It has the following requirements
- 托管媒体的服务器/应用程序必须支持字节范围. Safari将尝试2字节的下载以确定媒体的长度,然后将根据文件的大小以一个或多个块的形式下载媒体.如果仅发送所有数据,它将无法正常工作.
- 从媒体服务器返回的内容范围必须包括媒体总大小的数字,而不仅仅是"*".
- 媒体URL必须具有与媒体类型匹配的后缀.就像IE浏览器一样:正确设置mime类型是徒劳的,因为Safari不会遵循此处的规则,并且它将忽略mime类型.
请注意,如果Safari播放失败,它不会告诉您问题出在哪里,只是出现了媒体错误,没有更多信息.
Note that Safari doesn't tell you what the problem is if it fails on playback, there's just a media error raised with no further information.
对于mpeg 4视频/h.264,后缀.mp4有效 对于mpeg 4音频/aac,后缀.aac有效
For mpeg 4 video / h.264, the suffix .mp4 works For mpeg 4 audio / aac, the suffix .aac works
如果您是Safari开发人员,请考虑修复这些问题.
If you are a Safari dev please consider fixing these things.
这已在Safari 11.1.2上进行了测试
This is tested on Safari 11.1.2
这篇关于为什么Safari无法播放没有< video>扩展名的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!