Auto play sound?

58 views
Skip to first unread message

Gee Deezy

unread,
Jun 11, 2009, 2:28:46 PM6/11/09
to iPhoneWebDev
I would like to have an iPhone web app in HTML and PHP (could go
JavaScript) that includes the automatic playing of a sound when the
page loads, without leaving the browser.

I don't care what format the sound is in.
I don't care if the code is HTML, PHP, or JavaScript.

I just need it to work.

Can anyone assist?

Steve Tickle

unread,
Jun 11, 2009, 6:03:51 PM6/11/09
to iphone...@googlegroups.com
Depends on when you want to deploy. If you can wait a few weeks/months, add the following HTML5 to your web app:

<h1>Audio Test</h1>

<audio src="/aud/button-3.wav" autoplay>
Your browser does not support the audio element.
</audio>

This works in the latest version of Safari on Mac, expect the iPhone OS3.0 to follow suit soon. Otherwise, you need to write an Objective C application that uses UIWebView and has a Javascript-native event interface. I can help you with that if you wish to email me directly.

Regards,

Steve
st...@sixteenk.net

Sean Gilligan

unread,
Jun 11, 2009, 7:03:14 PM6/11/09
to iphone...@googlegroups.com
Gee Deezy wrote:
> I would like to have an iPhone web app in HTML and PHP (could go
> JavaScript) that includes the automatic playing of a sound when the
> page loads, without leaving the browser.
>

According to Apple it can't be done in Mobile Safari. Here's the
official word:
http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html#//apple_ref/doc/uid/TP40006482-DontLinkElementID_2

> I just need it to work.
>
> Can anyone assist?
>

I have written some Cocoa support code to use a "hybrid" approach to
play sound from a UIWebView. You may also want to look at PhoneGap
(http://phonegap.com/) and similar solutions.

-- Sean

Steve Tickle

unread,
Jun 12, 2009, 4:18:59 AM6/12/09
to iphone...@googlegroups.com
Though I think PhoneGap is a great project, I personally would steer clear as Apple are rejecting applications built with it.

I have an HTML5 standards compliant solution that will see you through until the iPhone support comes online. This will mean you do not have to re-write any of your HTML once support is available.

I can also offer you full source code plus support, should you require it.

Look forward to hearing from you.

Regards,

Steve

Gee Deezy

unread,
Jun 15, 2009, 7:46:16 AM6/15/09
to iPhoneWebDev
<EMBED AUDIO> or <AUDIO> doesn't actually seem to work. On safari
desktop, it doesn't fail, but it doesn't play sound either. On safari
mobile, this fails with the current version of Safari, as is it not
HTML5 compliant.

On Jun 12, 3:18 am, Steve Tickle <st...@sixteenk.net> wrote:
> Though I think PhoneGap is a great project, I personally would steer clear
> as Apple are rejecting applications built with it.
>
> I have an HTML5 standards compliant solution that will see you through until
> the iPhone support comes online. This will mean you do not have to re-write
> any of your HTML once support is available.
>
> I can also offer you full source code plus support, should you require it.
>
> Look forward to hearing from you.
>
> Regards,
>
> Steve
>
> On Fri, Jun 12, 2009 at 12:03 AM, Sean Gilligan <msgilli...@gmail.com>wrote:
>
>
>
>
>
> > Gee Deezy wrote:
> > > I would like to have an iPhone web app in HTML and PHP (could go
> > > JavaScript) that includes the automatic playing of a sound when the
> > > page loads, without leaving the browser.
>
> > According to Apple it can't be done in Mobile Safari.  Here's the
> > official word:
>
> >http://developer.apple.com/safari/library/documentation/AppleApplicat...
Reply all
Reply to author
Forward
0 new messages