在Android浏览器播放HTML5音频 [英] Playing html5 audio in android browser

查看:830
本文介绍了在Android浏览器播放HTML5音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JavaScript在浏览器中播放音频,使用HTML5 <音频> 标记。它工作正常,在iPhone的浏览器,但不是在Android的。 (使用测试的HTC Desire采用Android 2.1。)任何人都知道为什么吗?

I have a javascript that plays audio in the browser, using the html5 <audio> tag. It works fine in the iPhone browser, but not in Android. (Testing using a htc desire with android 2.1.) Anyone know why?

我的code:

   function playHTML5(sound, soundcv){
                // sound = url to m4a audio file
                // soundcv = div in which the audioplayer should go

  var audio = document.createElement('audio');
  audio.src = sound;
  audio.controls = "controls";
  if (currentSound != null){
   soundcv.replaceChild(audio,currentSound);
  } else {
   soundcv.appendChild(audio);
  }
  currentSound = audio;
 }

顺便说一句,我也试图放大音频按钮显示在iPhone(默认的是相当小的),没有运气为止! - 将不胜感激任何想法

By the way, I am also trying to enlarge the audio button that shows up in the iphone (the default one is quite small), with no luck so far - would be grateful for any ideas!

推荐答案

目前最新的Andr​​oid浏览器升级Froyo还不支持HTML5的音频元素。这是不是一个错误,而是一个尚未实现的功能。它可能会在姜饼。

The latest Android browser in FroYo does not yet support the HTML5 audio element. This is not a bug, rather a feature that has yet to be implemented. It may come in Gingerbread.

更新:姜饼浏览器有音频元素

Update: The Gingerbread browser has the audio element.

这篇关于在Android浏览器播放HTML5音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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