Solved

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

Posted on 2014-11-18
3
246 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

762 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

11 Experts available now in Live!

Get 1:1 Help Now