0

Hi i want to build a android webview app that plays a sound when the user solve the puzzel. For some reason i cant get the phonegap media api to work.

here the code :

function CheckFinished(){
        if(v1==1 && v2==1 && v3==1 && v4==1 && v5==1 && v==1){
                //alert('Done');
                playAudio();
                v=parseInt(0);}}

 function playAudio() {
    var myMedia = null;

    myMedia = new Media("/res/win.mp3", 
    function(){
        if (myMedia) {
            myMedia.stop();
            myMedia.release();
        }
    }, 
    function(error){
        console.log(error.message);
    }
);
    myMedia.play();}

1 Answers1

0

Try using webchromeclient instead of deafult client.

I don't have the exact link right now to share here. But, somewhere in android developers site it is mentioned that you have use webchromeclient to work with media files.

Hope this will help you.

Ajay Kumar Meher
  • 1,932
  • 16
  • 24