jQuery jPlayer更改媒体无法正常工作 [英] jQuery jPlayer change media not working

查看:101
本文介绍了jQuery jPlayer更改媒体无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用开发人员指南更改jQuery上的歌曲,我已经提出了这个功能:

I am trying to change the song on jQuery, using the developers guide, i have come up with this function:

<script type="text/javascript">
$(document).ready(function(){
    $('.embedinfo').click(function() {
        $("#jquery_jplayer_1").jPlayer( "clearMedia" );
        $("#jquery_jplayer_1").jPlayer({
        ready: function () {
            $(this).jPlayer("setMedia", {
                mp3:"/audio/<?php echo $audioarray[0]['audio']; ?>"

            }).jPlayer("<?php if(empty($auto)){ echo "pause"; }     elseif($auto==1){ echo "play"; } ?>");
        },
        swfPath: "/js/Jplayer.swf",
        supplied: "mp3",
        wmode: "window",
        solution:"flash,html",
        volume:"1"
        });
    });

});

setMedia 功能实际上与我用来设置音乐的功能相同(确实有效)但是这个改变音乐的功能不起作用。

The setMedia function is actually identical to the function i use to set the music initially (which does work), however this function to change the music from a click is not working.

clearMedia 的功能是工作,只是设置不是。为什么它不起作用?

The clearMedia function is working, just the set isnt. Why is it not working?

推荐答案

我找到了解决方案

而不是使用

$("#jquery_jplayer_1").jPlayer( "clearMedia" );

删除媒体,使用

$("#jquery_jplayer_1").jPlayer( "destroy" );

取消绑定.jPlayer的所有实例,允许从头开始更新媒体。

which unbinds all instances of .jPlayer, allowing the media to be updated from scratch.

这篇关于jQuery jPlayer更改媒体无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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