Audio on Android / IOS tablets, phones.

I’m trying to generate an audio alert (3 second sound clip) that will sound to alert the user to an event.

This works fine in desktop browsers but I cannot make it work on handheld devices.

I’m using the latest Vaadin 7 and the HTML5 Audio tag.

I’ve created a simple Vaadin UI project with 1 button to sound an alert.

After researching the problem, I’m aware of certain restrictions imposed by handheld devices, supposedly to save cell phone bandwidth. E.g.

https://developer.apple.com/library/safari/documentation/audiovideo/conceptual/using_html5_audio_video/device-specificconsiderations/device-specificconsiderations.html

So I’ve tried various JavaScript attempts at solving the problem. I can get this working in the desktop but again nothing in handhelds.
In my button click listener I’ve tried
Vaadin only:

            final Audio barkClip = new Audio(null, new ThemeResource("barking.mp3"));
            barkClip.setShowControls(false);
            layout.addComponent(barkClip);
            barkClip.play();

JavaScript Using Howler.js or Buzz.js audio libraries:
Page.getCurrent().getJavaScript().execute(“var sound = new buzz.sound("http://localhost:8084/HowlerTest/VAADIN/barking.mp3\”); sound.load().play()");

I’ve tried my own extend of AbstractJavaScriptComponent with :

this.doplay = function() {
var sound = new buzz.sound(“http://localhost:8084/HowlerTest/VAADIN/barking”, {
formats:[“mp3”, “ogg”]
,
preload: false,
controls: true,
autoplay: false,
loop: false
});
sound.load();
sound.play();

After some hacking, I can get these working in the Desktop but nothing for HandHelds.

Any ideas? I familiar to Java but a JavaScript novice.

Many thanks
David Robb.

Forgot to mention that The tablets are HTML5 Audio compatible and can play the audio files as if I have setShowControls(true) I can manually play the audio. But not much good for an alert notification!

Also the
http://buzz.jaysalvat.com/documentation/sound/
demo tests can produce a sound.

I feel sure there ought to be a solution, I’ve just not found it yet.

Anyone successfully using audio on tablets?

David - any luck with this?? I’ve been trying for several days now to get some sound out of an android device using the Audio component and have been stymied. It works on the desktop but not in the mobile device. It’s killing me!!!

Sorry, I never did find a solution. I’m sure it should be possible as other websites manage it. Probably needs a custom javascript component. I’ve found myself requiring more and more in Javascript to acheive exactly what I want. As a result thinking about a re-write of the front end to use NodeJS, Express, Backbone and Marionette…