YouTube API音量切换

时间:2012-04-10 13:46:19

标签: api youtube

想知道是否有可能(以及如何)使用YouTube iframe API在播放器外部设置html按钮或链接,以打开和关闭声音。

谢谢,
莫罗

1 个答案:

答案 0 :(得分:-1)

请参阅jQuery Youtube Plugin了解完整规格并下载。      
可以宣布这样的球员:

 jQuery("#youtube-player-container").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: "DkoeNLuMbcI", // 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
        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
    });
Then just add a link with the desired function:
<a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("mute")'>   
Mute player