IonDen/ion.sound

Autoplay not working on mobile safari [restriction]

talipbyk opened this issue · 10 comments

I create one button for sound and when I click the button it works. But I want that it works as autoplay.I mean when the user enter the website, the sound should start automatically. By the way i am workıng on Safarı browser and this problem is occuring for mobile.(Not for PC). It is working on dekstop well. But i dont know why it doesnt work on mobile device.

When i click the button first, the sound is working then when i refresh the page, also autoplay works. but when i close to browser and open the browser again, autoplay doesnt work again. i have to click to button again to get the sound.

I would like to get help about how can i make it autoplay sound..

Hello, you can't do it on Mobile devices. It's a build in restriction. Check this Apple article about it. Section "User Control of Downloads Over Cellular Networks".

This means, that user action is a requirement to download and play a media on mobile device. Autoplaying sounds and video could bring a negative experience to users, because they have to pay a lot of money for mobile connection to 3G/4G/LTE.

I think you misunderstand my problem. I upload the sound to my soruce codes. The user does not have to download the sound. The sound should play from soruce code.
This sound is working on Android systems but it does not work on IOS.
this sound is short example bip

I understand. Safari does not care about it, the whole audio system in safari is disabled until any user action.

All right.
Thank you for your interest.
I have last question.
How about if i use google chrome on IOS ?
do you think it will work ?

Nope, Google Crome on iOS is using the same webkit as Safari. Apple restriction.

Can you post a working example of code here if it's okay? I have read through all the examples but still can't get the code to work properly and don't understand why everything has to be so difficult on iOS. You code works normally on Android devices and PCs easily.

Hi guys, I also faced this problem some months ago, and this is not for the ion script but an IOS restriction.
My solution was to set a button, audio button, to "enable" the audio in the app, and set to play some audio when the user press it. Since the moment the user click the button, sounds will play and will sound for the rest of the time users can spend in the app, even in background as my app work right now.
Hope this can help.
Regards,

I currently faced a additional "unwanted" behavior.
I have a Sound which I start on webpage load, on iOS and Android the SOund is not played (which is completly ok). But then when I click a Button to play an another Sound I head the sound which i autostarted too (its looping). On Android is only playing the sound which I start on Button Press. The Behavior on Android is the one I expected.
So who's wrong, iOS or ANdroid, and is it fiixable :)

@X-Tender i will check this soon.

Thank you