howler.js和phonegap不像团队一样工作?

时间:2017-03-21 02:27:12

标签: javascript cordova audio howler.js

我尝试使用howler.js在phonegap应用中播放声音链。在移动浏览器甚至普通浏览器中,此代码工作正常!但当我编译成apk或我使用phonegap构建..我无法从howler.js得到任何声音:(

以下代码非常基本,它仅适用于一个声音片段,但我的问题是相同的......

function load_sound_test() {
// just for set the clip

    var namesoundtest =  "sounds/effects/" + document.getElementById('xsoundtest').value + ".webm";     
    var newnamesound = array_sound_test.push(namesoundtest);
    var namesoundtest =  "sounds/effects/" + document.getElementById('xsoundtest').value + ".mp3";      
    var newnamesound = array_sound_test.push(namesoundtest);
    var namesoundtest =  "sounds/effects/" + document.getElementById('xsoundtest').value + ".wav";      
    var newnamesound = array_sound_test.push(namesoundtest);    

    sound_test = new Howl({
      src: array_sound_test,
      preload: true,
      autoplay: false,
      loop: false,
      buffer: true
    });
console.log("sound test loaded");
}

function play_sound_test() {
// just to play the clip

    sound_test.play()
    console.log("sound test played");

}

0 个答案:

没有答案