我有一个phonegap应用程序,现在正在对PlayStore进行alpha测试。 该声音适用于大多数设备,但不适用于采用Android 4.x的三星设备。 我没有找到问题或类似的问题。我做错什么了吗?为什么phonegap应用程序不能在Android上使用Android 4在三星上播放声音?
代码https://github.com/goldfire/howler.js/tree/2.0
\t \t var sound = new Howl({
\t \t src: ['res/raw/warning.mp3']
\t \t }).play();
我的代码与科尔多瓦 - 插件 - 媒体:
\t \t var src = "res/raw/warning.mp3";
\t \t // HTML5 Audio
\t \t if (typeof Audio != "undefined") {
\t \t \t new Audio(src).play() ;
\t \t // Phonegap media
\t \t } else if (typeof device != "undefined") {
\t \t \t // Android needs the search path explicitly specified
\t \t \t if (device.platform == 'Android') {
\t \t \t \t src = '/android_asset/www/' + src;
\t \t \t }
\t \t \t var mediaRes = new Media(src,
\t \t \t \t function onSuccess() {
\t \t \t \t \t // release the media resource once finished playing
\t \t \t \t \t mediaRes.release();
\t \t \t \t },
\t \t \t \t function onError(e){
\t \t \t \t \t alert("error playing sound: " + JSON.stringify(e));
\t \t \t \t });
\t \t \t mediaRes.play();
\t \t } else {
\t \t \t alert("no sound API to play: " + src);
\t \t }
任何人都知道问题的根源是什么?
在屏幕上点击是不可能的,因为它的应用程序试图检测无意识。但我会尝试其他tipps。谢谢! – Lilliput
html5使它不能在Android5上工作,并且等待载入没有改变任何东西:( – Lilliput
改变为cordova-plugin-media也没有改变任何东西。再次没有三星与Android 4的声音 - 但在三星的Android 6更好! – Lilliput