国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - IOS WeChat audio tag cannot be played through touchend
給我你的懷抱
給我你的懷抱 2017-06-30 09:56:15
0
2
1098

To make an h5 mini-game, you need to long press and release the button to play a sound effect

GameStart.addEventListener('touchend', function(event) {
    event.preventDefault();
    Audio.play();
}, false);

The mechanism of IOS must be manually triggered by the user, but this should be considered correct for me, right?
I don’t understand very much, but it can be played normally with touchstart. I hope someone can explain it,
or something else The solution can solve my need.
Long press the button and release it before playing the sound effect

給我你的懷抱
給我你的懷抱

reply all(2)
Peter_Zhu

Note: On iOS, the Web Audio API requires sounds to be triggered from an explicit user action, such as a tap. Calling noteOn() from an onload event will not play sound.

I searched for a long time but couldn’t find Apple’s exact definition of user action. Maybe touchend does not belong to user action
As far as I can try now, click and touchstart are feasible

You can try to execute Audio.load() at touchstart, and then execute Audio.play() at touchend;

ringa_lee

This method is the solution!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template