javascript - How to set volume on audio.play() - Stack Overflow

Nothing fancy here, I just want the audio to play at a desired volume level.var audio = new Audio('

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.

Thanks!

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.

Thanks!

Share Improve this question asked Apr 10, 2017 at 1:39 DshizDshiz 3,3614 gold badges35 silver badges63 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

You set volume like so

audio.volume = 0.75; // 75%

You can simply just do this:

audio.sound = .5

Before you call audio.play ()

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745634358a4637297.html

相关推荐

  • javascript - How to set volume on audio.play() - Stack Overflow

    Nothing fancy here, I just want the audio to play at a desired volume level.var audio = new Audio('

    22天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信