video tag html5 with src from base64_encode not work on different device and browser

僤鯓⒐⒋嵵緔 提交于 2019-12-10 22:29:04

问题


i try this code.

<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>

it's work when i play in Notebook(safari, firefox) but not work when i play on IPAD2(safari) or Samsung Galaxy(Opera). i think the problem is in

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

because when i replace with

src="kecak.mp4"

it's work at all device and browser. i must use base64_encode(trim(file_get_contents('kecak.mp4'))) because in real my case it's come from response from RESTFul to delivery video via http. string response from http same with base64_encode(trim(file_get_contents('kecak.mp4'))). thx u for help :-)


回答1:


Why do you add AAAA? may be try just like this: < ?php echo base64_encode(file_get_contents($yourfile));?>

B



来源:https://stackoverflow.com/questions/8829710/video-tag-html5-with-src-from-base64-encode-not-work-on-different-device-and-bro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!