Skip to main content
El-Ekim
Participating Frequently
December 18, 2020
Answered

I can't get IOS to make a sound when using a HTML5 Canvas

  • December 18, 2020
  • 1 reply
  • 618 views

When I try to place a button on my HTML5 canvas that activates a sound (mp3) it works fine on desktops and android devices but not on my IOS device (Iphone IOS 14.2). 

 

When I use this code in the first frame:

this.aBtn.addEventListener("click",clicked);
function clicked(){
    createjs.Sound.play("sound");
}

After creating a button with the instance name aBtn and added a file.mp3 to the library with a linkage name sound I don't hear anything on my IOS device (with Safari en firefox) . It does work great on my desktop and android phone.

 

I tried many different approaches but without success.

 

(I' using Adobe Animate 21.0)

 

Can somebody point me toward a solution?  Tnx in adv!  

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

 

Making videos and sound work properly in iOS is always a challenge...

 

There several limitations and issues you should be aware of:

SoundJS v1.0.0 API Documentation : Sound (createjs.com)

 

It may be the WebAudio context that needs "to be 'unlocked' by playing at least one sound inside of a user- initiated event" - and that's the reason I added that initial check for Chrome -, or because of audio format, or plugins... It's really hard to tell.

 

You're gonna have to test it out.

 

I wish I could be of more help.

 

Regards,

JC

1 reply

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
December 18, 2020

Hi.

 

Making videos and sound work properly in iOS is always a challenge...

 

There several limitations and issues you should be aware of:

SoundJS v1.0.0 API Documentation : Sound (createjs.com)

 

It may be the WebAudio context that needs "to be 'unlocked' by playing at least one sound inside of a user- initiated event" - and that's the reason I added that initial check for Chrome -, or because of audio format, or plugins... It's really hard to tell.

 

You're gonna have to test it out.

 

I wish I could be of more help.

 

Regards,

JC