Link to home
Start Free TrialLog in
Avatar of Thunderman54
Thunderman54Flag for United States of America

asked on

Can you do onLoad audio with other browsers such as Safari, Android, etc.

Haven't done a ton of research on this. Figured I'd "ask the experts" and use my paid subscription. I pasted the following code in my browser (Chrome - see below) . Works fine on Windows. Won't work (play as page loads) on my Asus tablet (Android). Haven't tested on my wife's Mac notebook yet or her iPad, but from what I'm reading online I don't think it's going to work on those devices either. Should it work in all browsers on all devices? Something I'm overlooking? Any work-arounds? I just have a 6 second audio clip I want to play as the web page loads, but I'd like to get it to work on all browsers/devices, if possible. Of course, I do understand, even if it is possible, there's no guarantee the user will have his/her speakers turned on and the volume turned up. BTW, I don't want any controls visible on the page.

<embed src="whistle.mp3" autostart="true" hidden="true" loop="false"></embed>
Avatar of Greg Alexander
Greg Alexander
Flag of United States of America image

I would suggest using HTML5 audio tag which will be the most universal way to do it I believe:

<audio controls>
  <source src="your_path_to_file.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

Open in new window


There are options for the controls and what not too.

source: http://www.w3schools.com/tags/tag_audio.asp
Avatar of Thunderman54

ASKER

Since I posted my question I see where the audio tag has "autoplay" as one of the control properties. Do some of the browsers/devices not support this? Do you know? As I said, haven't done a lot of testing - obviously - but that seems to be what some are saying on the Internet as I do some research on this issue.
ASKER CERTIFIED SOLUTION
Avatar of Greg Alexander
Greg Alexander
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial