简体   繁体   English

如何在audio.play()上设置音量

[英]How to set volume on audio.play()

Nothing fancy here, I just want the audio to play at a desired volume level. 这里没什么好想的,我只想让音频以所需的音量播放。

var audio = new Audio('mysound.mp3');
audio.play();

I assume there are parameters I can pass into audio.play, but I've had a hard time finding a good reference. 我假设有一些参数可以传递给audio.play,但我很难找到一个好的参考。

Thanks! 谢谢!

像这样设置音量

audio.volume = 0.75; // 75%

You can simply just do this: 您只需执行以下操作:

audio.sound = .5

Before you call audio.play () 致电audio.play ()之前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM