【问题标题】:Audio not playing in Ipad but is playing in laptop音频不在 Ipad 中播放,但在笔记本电脑中播放
【发布时间】:2014-11-23 09:19:19
【问题描述】:

音频正在笔记本电脑和 PC 中播放,但未在 ipad 中播放。我尝试了不同的 ipad,但它没有播放音频。

<script>
   jQuery(document).ready(function(){
        var audioElement = document.createElement('audio');
        audioElement.type='audio/mpeg';
        audioElement.setAttribute('src', '/*file url over here*/');
        audioElement.setAttribute('autoplay', 'autoplay');
        $.get();
        audioElement.addEventListener("load", function() {
            audioElement.play();
        }, true);
        audioElement.play();
    });
</script>

【问题讨论】:

  • 我找到了答案。 $.get();应该是 jQuery.get();.

标签: javascript html ipad audio


【解决方案1】:

您需要确保您已经制作了一个 srcset,它涵盖了所有设备/浏览器上所有支持的编解码器。

http://en.wikipedia.org/wiki/HTML5_Audio#Supported_browsers

【讨论】:

    【解决方案2】:

    我找到了答案。 $.get();应该是 jQuery.get();

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-08
      • 2014-06-13
      • 1970-01-01
      相关资源
      最近更新 更多