0

I'm making a web app that plays a small mp3 file to notify the user for an update. I am using the HTML5 Audio API:

var notifyAudio = new Audio("path/to/audio.mp3");
//some code...
//Callback function called when I want to notify the user
function notify(){
  notifyAudio.play()
}

It works perfectly in the Chrome desktop browser, but when I tested it in the Android devices, It won't, not even loading the mp3 file, her is what I get in the Chrome Device debugger

enter image description here

Sn0opr
  • 1,016
  • 2
  • 12
  • 38
  • Take a look [link](https://code.google.com/p/android/issues/detail?id=10546)... But maybe this can help you [link](http://stackoverflow.com/a/4480795/4385913) – Skizo-ozᴉʞS ツ Jan 27 '15 at 11:05

1 Answers1

0

I believe you need to prefix the path in Android for Media playing with /android_asset/www. See my blog post for a full demo here - http://www.raymondcamden.com/2014/06/23/Cordova-Media-API-Example. Also, make sure you actually added the Media plugin.

Raymond Camden
  • 10,661
  • 3
  • 34
  • 68