来自base64_encode的带有src的视频标签html5在不同的设备和浏览器上不起作用



我尝试这个代码。

<video width="320" height="240"  controls="controls" autobuffer="autobuffer">
<source src="data:video/mp4;base64,AAAA<?php echo   chunk_split(base64_encode(trim(file_get_contents('kecak.mp4'))));  ?>" type="video/mp4" /> 
Your browser does not support the video tag.
</video>

当我在Notebook(safari,firefox)中玩时它是有效的,但当我在IPAD2(safari)或三星Galaxy(Opera)上玩时它不起作用。我认为问题出在

src="data:video/mp4;base64,AAAA<?php echo chunk_split(base64_encode(trim(file_get_contents('kecak.mp4'))));  ?>

因为当我用替换时

src="kecak.mp4"

它适用于所有设备和浏览器。我必须使用base64_encode(trim(file_get_contents('kecak.mp4')),因为在实际情况下,它来自RESTFul对通过http交付视频的响应。来自http的字符串响应与base64_encode(trim(file_get_contents('kecak.mp4'))相同。thx u获取帮助:-)

为什么添加AAAA?可以这样尝试:<php echo base64_encode(file_get_contents($yourfile));?>

B

最新更新