我目前使用javascript生成的html5 dom内容在网页中播放一些声音.
在Firefox和谷歌浏览器浏览器没有问题,一切正常但在Android设备上我听不到声音(即使我使用谷歌浏览器移动).
我使用ogg vorbis内容(我的Android设备支持,如w3schools报告,同样适用于"支持"网站,并根据我对音频标签播放的测试.)我的所有功能都被正确调用(console.log和警报测试已经完成),我的设备在所有输出端启用声音,当我启动音频元素时,音频标签的所有功能都处于良好的值:
a.readyState => 4
a.currentSrc => right url
a.error => null
a.volume => 1
Run Code Online (Sandbox Code Playgroud)
你有没有听说过类似的问题?
提前致谢.
链接:我的应用程序:http://ci.worldheberg.com/test.html 我的javascript脚本:http://ci.worldheberg.com/test.js 来源:已编辑(无法发布超过2个链接)
有关的代码:
// attente是一个数组,包含启动每个音频部分之前的时间
function playSound() {
"use strict";
console.log("play sound fonction");
var actuel, i, fonction;
actuel = -1;
fonction = function () {
actuel++;
console.log(a = audios[actuel]);
/*alert(a.readyState);
alert(a.currentSrc);
alert(a.error);
alert(a.volume);*/
a.volume = 1;
a.play();
};
for (i = 0; i < audios.length; i++) {
alert(attente[i]);
window.setTimeout(
fonction,
(attente[i])
);
} …Run Code Online (Sandbox Code Playgroud)