Html5 video tag with src from base64_encode not working on different devices and browser

I am trying 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 works when I play in a laptop (safari, firefox), but it does not work when I play on iPad2 (safari) or Samsung Galaxy (Opera). I think the problem is

 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 works on all devices and in the browser. I have to use base64_encode (trim (file_get_contents ('kecak.mp4'))) because in my case it comes from a response from RESTFul to a delivery video via http. string response from http with base 64_encode (trim (file_get_contents ('kecak.mp4'))). thanks u for reference :-)

+2
source share
1 answer

Why are you adding AAAA? maybe so: <? php echo base64_encode (file_get_contents ($ yourfile)) ;? >

IN

+2
source

Source: https://habr.com/ru/post/1388322/


All Articles