A note to use for mobile audio

Source: Internet
Author: User

These days to do mobile music playback, sure enough is to trample the pit constantly ah!

One is that a good playback function, available on a PC, is available on the phone's Shell browser, but not on native browsers and Chrome.

Toss for a long time (mainly or mobile debugging really inconvenient AH), the final location to the problem is:

Mobile The first time an audio object is played, it must be a user-triggered behavior.

At least in my current 4.3 Samsung S4 native browsers and Chrome31, I believe it will be the same in future versions.

Therefore, the asynchronous acquisition of the playback of the resource link to play the implementation of the two browsers will be invalidated.

Workaround:

Since it is not asynchronous, the simplest way is to change the synchronization. Of course, this is unrealistic for the project ...

As mentioned above, this restriction is for the same audio object, which requires user behavior to be triggered only when it is first played, and then it can be manipulated as it pleases.

So the way I use it is:

Global use of the same audio object, and at the time of the user's first point of playback, in the synchronization phase, with an empty music (no sound, playing time 1s) first play, and so on to get the asynchronous results and then the SRC replacement on the line.

A note to use for mobile audio

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.