0

我在 SO 和 MediaElements 的网站上查看了其他一些资源,但似乎没有任何效果。

我尝试制作一个 JSFiddle,但它不会在 IE8 中加载:http: //jsfiddle.net/RyzaV/

这是代码:

<div id="video" class="box">
    <video width="200" height="155" style="width: 100%; height: 100%;" id="player1" controls="controls" preload="true">
        <source type="video/<?php echo $video_format; ?>" src="<?php echo $video_url; ?>" />
        <object width="200" height="155" type="application/x-shockwave-flash" data="http://s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/flashmediaelement.swf">
            <param name="movie" value="http://s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/flashmediaelement.swf" />
            <param name="flashvars" value="controls=true&file=<?php echo $video_url; ?>" />
        </object>
    </video>

   <link type="text/css" rel="stylesheet" href="//s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/mediaelementplayer.min.css" />
   <script type="text/javascript" src="//s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/mediaelement-and-player.min.js"></script>
   <script type="text/javascript" language="javascript">
        $('#video').find('video:first').mediaelementplayer({
            success: function(media, node, player) {
                $('#' + node.id + '-mode').html('mode: ' + media.pluginType);
            }
            , flashName: 'flashmediaelement-cdn.swf'
        });
    </script>
</div>

知道我错过了什么吗?这是参考页面:
http ://www.mediaelementjs.com/#note2

4

2 回答 2

0

您应该在 head 标签中加入以下几行:

<link type="text/css" rel="stylesheet" href="//s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/mediaelementplayer.min.css" />
<script type="text/javascript" src="//s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/mediaelement-and-player.min.js"></script>

然后,确保在 mediaelement-and-player.min.js 之前调用 jQuery。

于 2013-12-04T10:17:13.453 回答
0

不确定究竟是什么导致了问题,但以下最终工作(看起来object标签导致了问题):

<div id="video" class="box">
    <video width="200" height="155" style="width: 100%; height: 100%;" id="player1" controls="controls" preload="true">
        <source type="video/<?php echo $video_format; ?>" src="<?php echo $video_url; ?>" />
    </video>

   <link type="text/css" rel="stylesheet" href="//s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/mediaelementplayer.min.css" />
   <script type="text/javascript" src="//s3.amazonaws.com/websites.retailcatalog.us/media/mediaelements/mediaelement-and-player.min.js"></script>
   <script type="text/javascript" language="javascript">
        $('#video').find('video:first').mediaelementplayer({
            success: function(media, node, player) {
                $('#' + node.id + '-mode').html('mode: ' + media.pluginType);
            }
            , flashName: 'flashmediaelement-cdn.swf'
        });
    </script>
</div>
于 2013-12-04T18:35:55.613 回答