加mp4文件后js失效,Video.js中的MP4在完全加载之前无法播放

I'm using Video.js to play back videos in MP4 format on a client's website.

The player uses html5 video and Adobe Flash Player as a fallback.

(In my case it seems to use Flash always so I don't know if the problem exists in the native html5 player as well.)

The video only starts playing after the *.mp4 file is completely loaded. So no buffer for a few seconds. The file must be completely downloaded by the browser before it starts playing.

When the video is long, the visitor has to wait very long before he can even see that the video is working.

The question now is, is it the browser, the script (video.js) or the video file that creates that problem.

On the videojs.com website however the video is playing back while loading, so works properly. Therefore I think it can't be the browser.

Has anyone else had that problem? How can I fix this issue?

Any advice is very much appreciated!

Thanks

Max

解决方案

That occurs because the moov atom of the mp4 file is on the end of the file, the player needs to know the moov atom before start playing, you can move easily the moov atom to the beginning of the file with MP4Box, there is a gui version for Windows.

In Linux command line you move the MA with: MP4Box -add my_video.mp4 my_newVideo.mp4.

This takes a few seconds.

More info:Adobe's explanation of moov atomhere

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值