【问题标题】:html5 audio tag on android devicesandroid设备上的html5音频标签
【发布时间】: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


    【解决方案1】:

    好的

    经过大量尝试,我终于找到了问题所在。

    对于所有遇到相同问题的人,请检查您的采样频率是否为 44100 Hz(我在任何地方都没有看到此信息,但尝试过,...) 电脑版chrome支持更多频率,但默认的android浏览器和chrome mobile不支持更高频率。

    我希望我的经验可以用于其他人。

    非常感谢所有看到此消息的人(我在这个错误上已经超过 3 天了)

    【讨论】:

    • 您在移动设备中的哪些方面进行了更改?
    • 在录音机的“...”后面找到它(Samsung Galaxy S8)。默认设置为 44.1kHz(中)。设置为低(也是 44.1kHz)和高(48kHz),但都没有帮助。
    猜你喜欢
    • 2011-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多