Jplayer抓取mp3文件,但不播放它

时间:2013-02-20 03:53:15

标签: wordpress jplayer

我正在尝试使用jplayer播放自定义字段中添加的mp3文件。所以当我在帖子jplayer中点击mp3文件时抓取mp3文件,但到目前为止它只显示文件和艺术家的名字,但我无法让它实际播放该文件。

我在single.php上使用此代码:

<div class="mp3jplayer-track">
<a class="playprogram" href='javascript:initMp3("<?php echo $mp3_url; ?>", "<?php echo $mp3_name; ?> - <?php /*if there is an artist specified for each mp3, we get it, otherwise we get the taxonomie Artists*/ if ($mp3_artists != ''){ echo 'Artist(s): '.$mp3_artists;}  else { echo 'Artist(s): '.$artists_names; } ?>")'>Play <br><span class="mp3_name"><i class="icon-music icon-white"></i><span class="mp3_name_text"><?php echo $mp3_name ?></span></span></a>   </div>

jplayer在我的页脚中看起来像这样:

<div id="jp_container_1" class="jp-audio">
    <div class="jp-type-single">
        <div class="jp-gui jp-interface">
            <ul class="jp-controls">
                <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
                <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
                <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
            </ul>

            <!--
            <ul class="jp-toggles">
                <li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
                <li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
            </ul>
            -->

            <div class="jp-progress-group">
                <div class="jp-current-time"></div>
                <div class="jp-progress">
                    <div class="jp-seek-bar">
                        <div class="jp-play-bar"></div>
                    </div>
                </div>
                <div class="jp-duration"></div>
            </div>

            <div class="jp-volume-group">
                <a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a>
                <a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a>
                <div class="jp-volume-bar">
                    <div class="jp-volume-bar-value"></div>
                </div>
                <a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a>
            </div>

            <div class="jp-time-holder">

            </div>

        </div>
        <div class="jp-title">
            <ul>
                <li></li>
            </ul>
        </div>

        <div class="jp-no-solution">
            <span>Update Required</span>
            To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
        </div>

    </div>
</div>

加载mp3的javascript:

function initMp3(mp3file, mp3info){
jQuery.noConflict()(function($){
/* DEBUG
window.alert(mp3file);
window.alert(mp3info);
*/

$("#jp_container_1").css("display","block");

$("#jquery_jplayer_1").jPlayer( "clearMedia" );
$("#jquery_jplayer_1").jPlayer( "setMedia" , {
    mp3:mp3file
});

$("#jquery_jplayer_1").jPlayer({
    ready: function () {
        $(this).jPlayer("setMedia", {
            mp3:mp3file
        }).jPlayer("play");
    },

    swfPath: "js",
    supplied: "mp3",
    wmode: "window"
})

$(".jp-title ul li").text(mp3info);
$("#jquery_jplayer_1").jPlayer("play");

});
};

我真的在搜索,但我找不到为什么它不起作用,任何想法?

1 个答案:

答案 0 :(得分:0)

好的,我修复了这个问题,我的swf路径坏了,出于某种原因,firefox不能让我们成为html播放器......