Mac can't play audio audio

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.