Today's colleague testing activities, background sound (multiple) Mac can not make a sound, a few phones have tried, no use. However, on the Android machine is not the problem, normal.
The first thought is the JS conflict problem, the page all things to add processing (empty, one by one add in), in order to test convenience, on the page Add a button, click Play.
Add to the end, there is no problem.
Suddenly think of Baidu to find the answer to a statement: need to touch trigger. Anyway, it probably has to be an artificial trigger, not our JS to invoke the Click event.
So, we added a button on the original page, and when clicked, the sound came out.
To this step, the sound playback problem is resolved.
The next step is to solve the initial time, the sound emitted when clicked. As for the original button operation is a Start button of the page itself, fortunately, the beginning of the page has a Start button, otherwise, this trigger problem still need to continue to think (the outermost mask, then the user a click, trigger, and then remove the mask, or click the event as the other will click on the button).
Audio has a property of volume, which controls the volume, 1.0 is the highest, and 0.0 is muted. Just this value, cannot <audio volume= "0.0" id= "test" > So write. Instead, you need to use JS to set document.getElementById ("test"). volume=0.0. and JS initial setting, for the Apple machine, the beginning is not valid, Android is nothing.
Since can not volume start, can only change one way.
It suddenly occurred to me that if we started play (), we would not be able to capture it immediately after the parse (). Let the colleague go to try.
The result is success.
So the temporary solution is to click on the Start button, immediately call a few audio play () method, and then immediately parse ().
Mac can't play audio audio