2***@qq.com
2***@qq.com
  • 发布:2016-12-22 14:49
  • 更新:2017-11-22 16:42
  • 阅读:3477

plus.audio真机调试时播放声音正常,打包安装后,播放声音失败,是什么原因?

分类:HTML5+

var p=null;  
function playVoice(filename){  
    if ( plus.audio == undefined ) {  
        mui.toast('Device not ready!',{duration:'long',type:'div'})  
    } else{  
        // 播放操作  
        p = plus.audio.createPlayer("voice/"+filename);  
        p.play( function () {  
            //alert( "Audio play success!" );  
            mui.toast('Audio play success!',{duration:'long',type:'div'})  

        }, function ( e ) {  
            //alert( "Audio play failed: " + e.message );  
            mui.toast("Audio play failed: " + e.message,{duration:'long',type:'div'})  
        });  
    }  
}  

e.message:未知错误

2016-12-22 14:49 负责人:无 分享
已邀请:

最佳回复

BoredApe

BoredApe - 有问题就会有答案。

createPlayer 的地址需要使用平台相对地址 如"_www/voice/"

  • 6***@qq.com

    这个是对的

    2017-03-03 21:26

  • 李世皇朝

    的确是对的 正解 打包后 这样搞的 就能运行正常

    2018-01-18 23:29

xfstudy2116

xfstudy2116

我也遇到这个问题,解决了吗?

6***@qq.com

6***@qq.com

请问如何处理的

4***@qq.com

4***@qq.com - 铭记

请问如何处理的

3***@qq.com

3***@qq.com - 厉害我的哥

老铁 问题是怎样解决的?

该问题目前已经被锁定, 无法添加新回复