Javascript - 声音

标签 javascript html audio

是否可以在无需用户点击或鼠标悬停的情况下播放声音文件?

我有一个记分牌,我想在球队得分时播放声音文件。任何指示将不胜感激。我基本上完成了记分牌,但没有声音。

谢谢。

最佳答案

https://github.com/admsev/jquery-play-sound

$.playSound('http://example.org/sound.mp3');

document.getElementById('yourAudioTag').play();

关于Javascript - 声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25046030/

相关文章:

javascript - 如何将鼠标事件添加到 div 集并从数据库表单单击 div 加载数据?

java - public classname() 永远不会在类 classname 中调用 - Java

java - 一次只播放一个音频文件?

javascript - 如何创建带有自定义选项输入的选择下拉列表

javascript - Vanilla JavaScript : How to make the second number of two random numbers always higher than the first

html - 为什么这个元素在 Firefox 中不向左浮动?

javascript - 试图改变按钮的值(value)

python - Pygame不会抛出任何错误,但是不会播放任何音频

javascript - 所有者下拉列表不过滤故事纸板