Solved

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

Posted on 2014-11-18
3
259 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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with a header and phone number hyperlink 2 44
Wordpress "chart" plugin recommendation 7 60
ajaxSubmit is giving me an error 1 47
Button to go back 3 28
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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…

829 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