【发布时间】:2012-11-07 12:40:33
【问题描述】:
我正在使用 HTML5 AudioElement 播放我的 .mp3 文件,但我注意到无法跳过该位置。我正在通过 PHP 从 www 根目录之外获取文件。
我正在使用 HTML 代码:
<audio src="" controls id="appAudio" style="width:1000px;margin-top:10px"></audio>
JavaScript 代码:
document.getElementById('appAudio').src= 'http://localhost/index.php/player/get_audio_via_php/1';
PHP 代码:
$file = "/myfolder/1.mp3";
header('Content-Type: audio/mpeg');
header('Content-Length: ' . filesize($file));
return file_get_contents($file);
就像我说的那样,它会播放音频文件,但不能跳过位置。 这个问题有方法解决吗?
谢谢
【问题讨论】:
标签: php javascript html audio html5-audio