JavaScriptプログラムに関する各種メモ書き

最も簡単にYouTube動画を貼り付けるjqueryプラグイン

■ jQuery.tubeplayer.js ↓(ダウンロードは下記サイトの画面右下【Download ZIP】から)

https://github.com/nirvanatikku/jQuery-TubePlayer-Plugin

コードは下記のようになります

<script src="jquery.js"></script>
<script src="jQuery.tubeplayer.min.js"></script>
<div id='player'></div>
<script>
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: "[some 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
    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
});
</script>

簡単ですね。


関連エントリー

No.914
11/06 16:34

edit

YouTube
jQuery