【发布时间】:2013-05-06 17:19:57
【问题描述】:
我目前使用javascript生成的html5 dom内容来播放网页中的一些声音。
在 Firefox 和 google chrome 浏览器中没有问题,一切正常,但在 android 设备上我听不到声音(即使我使用 google chrome 移动)。
我使用 ogg vorbis 内容(我的 android 设备支持它,就像 w3schools 报告的那样,“它支持”网站也是如此,根据我对音频标签播放的测试。) 我的所有功能都被正确调用(console.log 和警报测试已经完成),我的设备上的所有输出都启用了声音,并且当我启动音频元素时,音频标签的所有功能都处于良好的价值:
a.readyState => 4
a.currentSrc => right url
a.error => null
a.volume => 1
你听说过类似的问题吗?
提前致谢。
链接: 我的申请: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])
);
}
}
【问题讨论】:
标签: javascript android html html5-audio ogg