简体   繁体   English

<audio>无法在Android浏览器上的https上播放

[英]<audio> not playing on https with Android browsers

So, I'm maintaining the main page of an archive located here , where an audio element gets inserted with a randomly chosen RELATIVE link to an audio file. 因此,我维护的存档主页位于此处 ,在其中插入音频元素,并随机选择一个指向音频文件的RELATIVE链接。 It plays the audio fine on desktop browsers, but it fails to play the audio on Android mobile browsers, like Dolphin Jetpack and Opera Mobile. 它可以在桌面浏览器上正常播放音频,但无法在Android移动浏览器(例如Dolphin Jetpack和Opera Mobile)上播放音频。 Code that creates the audio element: 创建音频元素的代码:

var d = document, $ = function(a){ return d.querySelector(a); }, o, a, b
    audios = ["htmlfiles/Log4/Audio Files/1339041384627.png.audio02.ogg",
    "htmlfiles/Log4/Audio Files/1339039129463.png.audio01.ogg",
    "htmlfiles/Log5/Audio Files/s05_08.png.audio01.ogg",
    "htmlfiles/Log6/Audio files/s06_19.png.audio01.ogg",
    "htmlfiles/Log7P1/Audio Files/s07_01.png.audio01.ogg",
    "htmlfiles/Log10/Audio files/1343286991927.png.audio01.ogg",
    "htmlfiles/Log10/Audio files/1343293678793.gif.audio02.ogg",
    "AudioFiles/1343888663849.png.audio02.ogg",
    "AudioFiles/1345719774310.png.audio01.ogg",
    "AudioFiles/1346311163394.png.audio02.ogg",
    "AudioFiles/1346919244950.png.audio02.ogg",
    "AudioFiles/1347509276756.png.audio01.ogg",
    "AudioFiles/1347515470408.png.audio02.ogg",
    "AudioFiles/1348079866537.png.audio01.ogg",
    "AudioFiles/1349419913717.png.audio01.ogg",
    "AudioFiles/1350030423418.png.audio01.ogg",
    "AudioFiles/1350033736151.png.audio02.ogg",
    "AudioFiles/1351231673165.png.audio01.ogg",
    "AudioFiles/1343870457212.png.audio01.ogg"];

/*The code above is in the head tag, the one below is at the end of the body tag*/

window.opera && (o = $('div:not([id])')).parentNode.removeChild(o);
var audio = d.createElement("audio")/*, source = d.createElement("source")*/;
audio.autoplay = audio.controls = audio.loop = true;
// source.type = "audio/ogg";
audio.src =/* source.src =*/ audios[Math.floor(Math.random() * audios.length)];
// audio.appendChild(source);
audio.appendChild(d.createTextNode("Your browser does not support the audio element."));
$("div#container").insertBefore(audio, $("div#container > div:last-of-type").nextElementSibling);

I'd like to know what can cause such behaviour. 我想知道什么会导致这种行为。 I've tested both mobile browsers on w3schools' try-it page, and their audio worked fine there. 我已经在w3schools的“试用”页面上测试了这两种移动浏览器,并且它们的音频在那很好。 I'm suspecting it could be something with the https protocol. 我怀疑这可能与https协议有关。

Edit: I've reported the bug for Opera through the report wizard, and for Mobotap via an email with a link to this question. 编辑:我已经通过报告向导报告了Opera的错误,并通过带有此问题链接的电子邮件报告了Mobotap的错误。

Just getting rid of this zombie. 只是摆脱这个僵尸。 In the end, I think updating the browsers at a later point fixed it. 最后,我认为稍后更新浏览器即可解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM