jQueryYouTube插件调用方法

jQueryYouTube插件调用方法,jquery,jquery-plugins,Jquery,Jquery Plugins,我正在使用jQueryYouTube插件嵌入Youtube视频,并在视频中使用一些API方法 我有以下代码: <div id="player"></div> <script type="text/javascript"> jQuery("#player").tubeplayer({ width: 600, // the width of the player height: 450, // the height of t

我正在使用jQueryYouTube插件嵌入Youtube视频,并在视频中使用一些API方法

我有以下代码:

<div id="player"></div>
<script type="text/javascript">
    jQuery("#player").tubeplayer({
        width: 600, // the width of the player
        height: 450, // the height of the player
        allowFullScreen: "true", // true by default, allow user to go full screen
        initialVideo: "VIDEO_ID", // the video that is loaded into the player
        preferredQuality: "default",// preferred quality: default, small, medium, large, hd720
        onPlay: function(id){}, // after the play method is called
        autoPlay: true,
        onPause: function(){}, // after the pause method is called
        onStop: function(){}, // after the player is stopped
        onSeek: function(time){}, // after the video has been seeked to a defined point
        onMute: function(){}, // after the player is muted
        onUnMute: function(){}, // after the player is unmuted
        onPlayerEnded: function(){alert('ENDED')},
    });
</script>

jQuery(“#player”).tubeplayer({
宽度:600,//播放器的宽度
身高:450,//玩家的身高
allowFullScreen:“true”,//默认为true,允许用户全屏显示
initialVideo:“VIDEO_ID”,//加载到播放机中的视频
preferredQuality:“default”,//首选质量:default、small、medium、large、hd720
onPlay:function(id){},//在调用play方法之后
自动播放:对,
onPause:function(){},//在调用pause方法之后
onStop:function(){},//在播放器停止后
onSeek:function(time){},//将视频搜索到定义的点后
onMute:function(){},//在播放器静音后
onUnMute:function(){},//在播放器解除静音后
onPlayerEnded:function(){alert('end')},
});
这可以很好地播放视频,但当视频结束时,我希望
onPlayerEnded()
函数会启动并向我发出
警报(“结束”)
,但它不会

以前有没有人用过这个插件,告诉我为什么会这样


非常感谢

它工作正常,您的浏览器可能有问题,请尝试使用console.log而不是alert,然后检查您的控制台

我将您的代码放在JSFIDLE中,它可以正常工作

您可以将最后一个逗号放在onPlayerEnded中吗?只有IE可能对最后一个逗号有问题7、8和9都不显示视频。即使使用SWFObject config addedUsing Chrome,似乎也解决了这个问题,我现在看到的警报似乎是Ubuntu11.10上FireFox 8/9中的一个bug。它可以在mac os x 10.7、Chrome和IE上使用FF,只是在ubuntu中不能使用FF,这很奇怪。