与SRC视频标签HTML5从base64_en code没有不同的设备和浏览器上运行 [英] video tag html5 with src from base64_encode not work on different device and browser
问题描述
我尝试这个code。
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>
它的工作时,我在笔记本玩(Safari浏览器,火狐),但是当我在IPAD2(Safari浏览器)或三星Galaxy(歌剧)玩不工作。
我认为这个问题是在
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')))); ?>
,因为当我换成
src="kecak.mp4"
这是在所有的设备和浏览器的工作。我必须使用 base64_en code(TRIM(的file_get_contents('kecak.mp4')))因为在现实我情况下,它来自通过HTTP REST风格的响应交付视频。从http同样与base64_en code(TRIM(的file_get_contents('kecak.mp4')))的字符串响应。
THXü的帮助: - )
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 :-)
推荐答案
为什么要添加AAAA?
可尝试就像这样:
&LT; ?PHP的回声base64_en code(的file_get_contents($ yourfile));?>
Why do you add AAAA? may be try just like this: < ?php echo base64_encode(file_get_contents($yourfile));?>
乙
这篇关于与SRC视频标签HTML5从base64_en code没有不同的设备和浏览器上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!