如何使用 PHP 顺序播放音频文件?
我有多个音频文件,我想按顺序播放而不是同时播放。我正在使用类似于以下的代码:
<audio controls autoplay='true'>
<source src="sample1.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio controls autoplay='true'>
<source src="sample2.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
在sample1完成播放后,我需要sample2播放 5 秒。在这两种情况下,都不应涉及用户交互。
更新
我认为这应该像使用连续的函数调用一样简单,但这不起作用。我开始使用下面的示例代码研究和使用 sleep() 函数:
print "<br>Line1";
sleep(10);
print "<br>Line2";
这只会将整个脚本延迟 10 秒并打印两个语句,而不是一个接一个地打印。音频文件也是如此,这最终是我要解决的问题。