📜  Safari 自动播放音频 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:39.950000             🧑  作者: Mango

代码示例1
const soundEffect = new Audio();

// onClick of first interaction on page before I need the sounds
soundEffect.play();

// later on when you actually want to play a sound at any point without user interaction
soundEffect.src = 'path/to/file.mp3';
soundEffect.play();