【问题标题】:MediaElement.js - How to Setup Flash Fallback for Audio?MediaElement.js - 如何为音频设置 Flash 后备?
【发布时间】:2012-09-04 18:54:32
【问题描述】:

我的目标是使用 MediaElement.js 在 ie8 中播放音频。应该使用 MediaElement.js Flash 后备。

我正在使用类似于如下所示的代码。它适用于 Chrome 和 ie9,但不适用于 ie8。音频控件应位于的位置会出现一个黑条,但看不到任何控件。

如果下面代码中的某些元素是正确的,我不会。例如,我不确定是否应该将对象选项卡放在音频标签内。

我怎样才能使闪存回退工作?

These three lines are inside the head tag:
<script src="path/to/jquery.js"></script>
<script src="path/to/mediaelement-and-player.min.js"></script>
<link rel="stylesheet" type="text/css" href="path/to/mediaelementplayer.css">


<audio id="player1" type="audio/mp3" controls="controls" src="absolute path/to/song.mp3">

    <source src="path/to/song.ogg"></source>

    <object width="400" height="30" type="application/x-shockwave-flash" data="absolute path/to/flashmediaelement.swf">
        <param name="movie" value="absolute path/to/flashmediaelement.swf" />
        <param name="flashvars" value="controls=true&file=absolute path/to/song.mp3" />
    </object>

</audio>

<script>
$(document).ready(function(){
    $('audio').mediaelementplayer();
});
</script>

【问题讨论】:

    标签: jquery audio internet-explorer-8 mediaelement.js


    【解决方案1】:

    我知道这是一个迟到的答案,但我想我还是会做出贡献,因为我刚刚遇到了类似的问题,其他人可能会觉得这个答案很有帮助。

    您的代码在我看来有点臃肿,因此更简单的解决方案是:

    <audio controls="control" preload="none">
        <source id="mp3_src" src="music.mp3" type="audio/mp3">      
        <source id="ogg_src" src="music.ogg" type="audio/ogg">
    </audio>
    

    确保 mp3 文件列在 ogg 文件之前,否则当 Flash 后备要启动时,您只会得到一个下载文件框。-无论如何在 IE9 中。

    【讨论】:

      猜你喜欢
      • 2011-11-02
      • 2012-09-26
      • 1970-01-01
      • 1970-01-01
      • 2012-09-03
      • 1970-01-01
      • 2017-08-31
      • 2017-07-22
      • 1970-01-01
      相关资源
      最近更新 更多