我希望当页面打开时,自动开始播放音乐
const Index = ({ data }) => {
return (
<audio
autoPlay="autoPlay"
href="audio_tag"
loop
src={data.audio.publicURL}
type="audio/mpeg"
controls
></audio>
}
由于音乐加载时间原因,页面打开时音乐未开始。 如何绕过音乐加载时间?
最佳答案
The music does not start when the page opens because of the loading time of the music.
不,音乐无法启动,因为浏览器不允许。
当前大多数浏览器的大多数页面都禁用音频自动播放。
另请参阅:https://docs.google.com/document/d/1_278v_plodvgtXSgnEJ0yjZJLg14Ogf-ekAFNymAJoU/edit
关于reactjs - 在网页react.js打开时自动播放mp3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58324889/