Created
April 13, 2012 23:37
-
-
Save alunny/2380994 to your computer and use it in GitHub Desktop.
play local audio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<h1>Playing Audio</h1> | |
<button onclick="playAudio('brobob.mp3')">Play Some Audio</button> | |
<script src="phonegap.js"></script> | |
<script> | |
function playAudio(src) { | |
if (device.platform == 'Android') { | |
src = '/android_asset/www/' + src; | |
} | |
var media = new Media(src, success, error_error); | |
media.play(); | |
} | |
function success() { | |
// ignore | |
} | |
function error_error(e) { | |
alert('great error'); | |
alert(e.message); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally I found something that works after ages of searching the net 😄
You're a life saver man,