Hello.
I use Audio player in HTML5Goodies.
In Microsoft Edge, it plays automatically,
It does not play automatically on iOS.
It plays when you click on the player,
I want to play automatically.
What is the problem?
I am using O11.

If you have a solution, please let me know.
Thank you.

Hi Katsuya,

Safari on iOS requires a user gesture to play media in a <video> or <audio> element.
This is the default behaviour of safari.

Regards,

Swatantra

But this default behaviour can be manipulated using WebKit’s New policies for video.

Webkit:

A note about the user gesture requirement: when we say that an action must have happened “as a result of a user gesture”, we mean that the JavaScript which resulted in the call to video.play(), for example, must have directly resulted from a handler for a touchend, click, doubleclick, or keydown event.
So, this would satisfy the user gesture requirement.

button.addEventListener('click', () => { video.play(); }) 

Traditional 'canplaythrough' would not.

video.addEventListener('canplaythrough', () => { video.play(); })

Hi, Swatantra Kumar

Thank you!

But, it ’s difficult for me.


iOS do'nt work.

<audio autoplay...>

If you do not touch the screen, "play ()" and "click ()" will not be played automatically by javascript.




If you trigger the javascript after page load.

$( document ).ready(function() {  WRITE YOUR LOGIC FOR video.play();  });

Thank you.
I tried it, but no sound.
If you put in the following statement and touch it, you will get a sound.
I had to touch.
     document.getElementById ('"+ MY_SCREEN +"') .addEventListener ('touchstart', function (e) {