HTML5音频不会在移动设备上玩 [英] HTML5 audio won't play on mobile devices

查看:162
本文介绍了HTML5音频不会在移动设备上玩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的HTML5开发人员,

Dear HTML5 developers,

我在遇到一些麻烦与此HTML5音频......所以,让我们跳进去。

I'm having some troubles with this HTML5 audio... So let's jump into it.

ap  = "<audio width='200' height='30' preload='auto' controls autobuffer>";
ap += "<source src='util/blob_audio.php?i=" + w + "&ogg=1' type='audio/ogg' />";
ap += "<source src='util/blob_audio.php?i=" + w + "&mp3=1' type='audio/mpeg' />";
ap += "</audio>";

我在JavaScript中产生,并在需要时方法返回。我想我不应该提,W的变量,这是一个参数( YouDon'tSay 的)和它的作品就好了。

I am generating it in JavaScript and a method returns it when needed. I guess I should not have to mention that "w" variable, that's a parameter (YouDon'tSay) and it works just fine.

应该差不多了吧?它们出现在桌面上,但他们有在移动设备上的麻烦(我已经在一个iPad2,Android的平板电脑3.2.1测试的Andr​​oid 2.3.6智能手机)。

It should be ok, right? They appear on desktops but they are having troubles on mobile devices (I have tested on an iPad2, Android 3.2.1 tablet, Android 2.3.6 smartphone).

据最高审计机关对iPad 2:无法播放音频文件。在元件。
而在Droid显示默认的音频元素,但没有音量控制,视觉上最高审计机关,它正在播放 - 从一开始就跳到结束

It sais on the iPad 2: "Cannot play audio file." in the element. And the Droid shows the default audio element, but without volume control, visually it sais that it is playing - jumping from the beginning to the end.

PHP的头看起来像这样(在blob_audio.php)(我们存储音频作为DB斑点[不要问我为什么,这不是我的想法):

The PHP headers looks like this (in the blob_audio.php)(we're storing the audios as blobs in the DB [don't ask me why, it wasn't my idea]):

header("Content-Type: audio/ogg"); // this is inside of a condition, this is the "ogg" part of it
header('Content-Length: ' . $length);
header('Content-Disposition: inline');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');

这工作得很好,因为一切都运行在桌面上。

This works just fine since everything works on desktops.

我在想,也许这些格式(MP3,OGG)未正确连接codeD为ARM架构的CPU(不支持codeC)。在MP3的情况下,这个的sh ​​ t的发生呢?

I was thinking that maybe these formats (mp3, ogg) are not correctly (not supported codec) encoded for ARM architecture CPUs. Can this sh*t happen in case of the mp3?

一个念头?任何人? =)

A thought? Anyone? =)

感谢您,

推荐答案

好吧,我们已经得到这个想通了。 =)

Okay, we have got this figured it out. =)

因此​​,这里的事实(见下面列出):

So here are the facts (see below listed):

问题的iStuffs - >我们正在通过安全连接(HTTPS)。这screwes了iShit HTML5音频处理。他们需要一些中间证书 - 可能是认证或我不知道 - 服务器证书链之间。所以,事情不是通过SSL工作我们的测试服务器上。谁知道... ...它的工作原理时,你通常部署进去。但是,在这里谈到的Andr​​oid,小心!

Problem at iStuffs -> We are working over secure connection (HTTPS). That screwes up the iShit HTML5 audio handling. They need some "intermedia certificate" - probably for authentication or I don't know - between the server's certificate chain. So the thing is not working on our test server via SSL. Who knew... It works in when you deploy it normally. But, here comes Android, watch out!

Android是可笑的,因为(如记录-_O)的Droid不通过SSL支持低于3.1版本的所有媒体格式。这是一个完整的搞砸了与人类......我不明白为什么它是这样一个使自动对焦他妈的系统能够通过在21世纪他妈的安全连接播放任何多/媒体的问题...这必须再次成为一些版权法的sh * t内我必须再次吐......

Android is funny, since (as documented -_O ) Droid does NOT support any media formats via SSL below version 3.1. This is a complete "screwing up with humanity"... I don't understand why it is such a problem to make a f*cking system able to play any multi/media via f*cking SECURE connection in the 21th century... This must be some copyright law sh*t again which I have to vomit again...

如果你想知道我们所做的来解决这个奔忙:
我们想通了,如果我们真的想使我们的应用程序跨浏览器和跨设备兼容(如果这是说不上吧正确的命名,但我敢肯定,你得到它;)),我们需要冒了出来声音从下SSL(多/媒体)。
因此为简单起见,我们已经创造了我们的音频文件的简单的HTTP子域(单独的文件夹层次结构中)(我们只需要由现在的音频),并使其可访问通过该子域+认证/通过脚本文件验证。
所以,一切都在HTTPS但多/媒体上的HTTP分开的。

In case you want to know what we have done to solve this sh*t: We figured out that if we REALLY want to make our app cross-browser and "cross-device-compatible" (dunno if this is correct naming for it but I'm sure you get it ;) ), we need to "take out" the audio (multi/media) from under SSL. So for the sake of simplicity we have created a simple HTTP sub-domain (separate folder in the hierarchy) for our audio files (we only need audio by now) and make it accessible through that subdomain + authenticate/validate through a script file. So everything goes under HTTPS but the multi/media is separate on HTTP.

做工精细,每一个他妈的设备上,随时随地。我知道这是一个大解决方案,但这个是最实施的因为我们是在测试这些东西的任何设备。

Works fine, on every f*cking device, anytime. I know it is a "larger" solution but this is the most "implementable" for any device we are testing these things on.

希望它帮助别人! =)
干杯!

Hope it helped somebody! =) Cheers!

这篇关于HTML5音频不会在移动设备上玩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆