Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/456.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery jPlayer更改介质不工作_Javascript_Jquery_Jplayer - Fatal编程技术网

Javascript jQuery jPlayer更改介质不工作

Javascript jQuery jPlayer更改介质不工作,javascript,jquery,jplayer,Javascript,Jquery,Jplayer,我试图在jQuery上更改歌曲,使用开发者指南,我想出了以下功能: <script type="text/javascript"> $(document).ready(function(){ $('.embedinfo').click(function() { $("#jquery_jplayer_1").jPlayer( "clearMedia" ); $("#jquery_jplayer_1").jPlayer({ read

我试图在jQuery上更改歌曲,使用开发者指南,我想出了以下功能:

<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"
        });
    });

$(文档).ready(函数(){
$('.embedinfo')。单击(函数(){
$(“#jquery_jplayer_1”).jplayer(“clearMedia”);
$(“#jquery_jplayer_1”).jplayer({
就绪:函数(){
$(this).jPlayer(“setMedia”{
mp3:“/audio/”
}).jPlayer(“”);
},
swfPath:“/js/Jplayer.swf”,
提供:“mp3”,
wmode:“窗口”,
解决方案:“flash,html”,
卷:“1”
});
});
}));

setMedia
功能实际上与我最初设置音乐时使用的功能完全相同(它确实起作用),但是这个通过单击来更改音乐的功能不起作用

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

我找到了一个解决办法

而不是使用

$("#jquery_jplayer_1").jPlayer( "clearMedia" );
如果要删除介质,请使用

$("#jquery_jplayer_1").jPlayer( "destroy" );
这将解除.jPlayer的所有实例的绑定,允许从头开始更新媒体