Solved

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

Posted on 2014-11-18
3
253 Views
Last Modified: 2014-11-18
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>
0
Comment
Question by:Thunderman54
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Greg Alexander
ID: 40450443
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
0
 

Author Comment

by:Thunderman54
ID: 40450540
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.
0
 
LVL 18

Accepted Solution

by:
Greg Alexander earned 500 total points
ID: 40450631
I am unaware of the browsers that do not support it... You could build in a check for that and at least give them controls if auto play is not supported:

http://mrcoles.com/detecting-html5-audio-autoplay/
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now