custom_5; ?>" type="audio/mp3" /> 播放器出现,-6ren">
gpt4 book ai didi

php -

转载 作者:可可西里 更新时间:2023-11-01 00:15:18 26 4
gpt4 key购买 nike

我有一个 <audio>具有如下控件的元素:

<audio controls="controls" id="audio-sample" preload="auto">
<source src="../../music-sample.php?type=ogg&amp;id=<?php echo $item->custom_5; ?>" type="audio/ogg" />
<source src="../../music-sample.php?type=mp3&amp;id=<?php echo $item->custom_5; ?>" type="audio/mp3" />
</audio>

播放器出现,声音播放正常,但轨迹栏没有移动以反射(reflect)耗时,也无法拖动来寻找。为什么不?我需要发送某种额外的标题吗?这是所有相关的 PHP,没有什么特别的:

header('Content-Type: ' . $mimetype[$type]);

$file = fopen($filename, 'rb');
fpassthru($file);
fclose($file);
exit();

You can see the problem live here.

最佳答案

尝试设置 Content-Length header ...

header("Content-Length: " . filesize($filename));

出于某种原因,如果没有事先提供该信息,它无法进行必要的数学运算来放置轨迹栏。

关于php - <audio> 控件的轨迹栏不移动的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13170411/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com