HTML5 audio from PHP script -
i want play audio generated php script.
client side:
<audio controls autoplay src="audio.php"></audio>
server side:
$path = 'somefile.mp3'; header('content-type: audio/mpeg'); header('cache-control: no-cache'); header("content-transfer-encoding: binary"); readfile($path);
it plays, can't change current time in audio element. range slider not working.
it missing few things in header in order seekbar work. content-length , accept-ranges. html audio player needs them in order build player seekbar.
try this:
$path = 'somefile.mp3'; header('content-type: audio/mpeg'); header('cache-control: no-cache'); header('content-transfer-encoding: binary'); header('content-length: ' . filesize($path)); header('accept-ranges: bytes'); readfile($path);
Comments
Post a Comment