YouTubeのiframe APIを使用して、プレーヤーの外部にあるHTMLボタンやリンクを使用してサウンドのオン/オフを切り替えることが可能かどうか(またその方法)を知りたいですか?YouTube APIボリュームを切り替える
おかげで、
マウロ
YouTubeのiframe APIを使用して、プレーヤーの外部にあるHTMLボタンやリンクを使用してサウンドのオン/オフを切り替えることが可能かどうか(またその方法)を知りたいですか?YouTube APIボリュームを切り替える
おかげで、
マウロ
は、完全な仕様とダウンロード用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
を参照してくださいyoutube apiはサウンドをトグルする 'player.mute()'とサウンドを切り替える 'player.unMute()'を提供しているので、外部プラグインを使う必要はありません。サウンドチャンネルの状態をチェックするために 'player.isMuted()' 。このソリューションは、単純なjavascriptのクリックイベントを使用すると、オーバーコードされています... – easwee
があり、[この](http://www.tikku.com/jquery-youtube-tubeplayer-plugin#tubeplayer_tutorial_1) – CosminO