参照:jQuery YouTube TubePlayer Plugin
動画のスータス:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <!-- JS --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> <script type="text/javascript" src="/content/lib/jquery/jQuery.tubeplayer.js"></script> <script type="text/javascript"> $(function(){ $("#youtube-player-container").tubeplayer({ width:560, // プレーヤーの幅 height:340, // プレーヤの高さ allowFullScreen:"true", // フルスクリーン再生を許可するか initialVideo:"9YEEl52u8XE", // 動画ID playerID:"youtube-player", // 埋め込み先の要素ID preferredQuality:"default", // 画質(default, small, medium, large, hd720) // プレーヤーが操作された時 onPlay:function(id){updateHTML("動画が再生されました");}, // after the play method is called onPause:function(){updateHTML("動画を一時停止しました");}, // after the pause method is called onStop:function(){updateHTML("動画の再生を停止しました");}, // after the player is stopped onSeek:function(time){updateHTML("シーク位置が変更されました");}, // after the video has been seeked to a defined point onMute:function(){updateHTML("ミュートを設定しました");}, // after the player is muted onUnMute:function(){updateHTML("ミュートが解除されました");}, // after the player is unmuted // プレーヤーの状態が変更された時 onPlayerUnstarted:function(){updateHTML("未再生");}, // when the player returns a state of unstarted onPlayerEnded:function(){updateHTML("再生終了");}, // when the player returns a state of ended onPlayerPlaying:function(){updateHTML("再生中");}, //when the player returns a state of playing onPlayerPaused:function(){updateHTML("一時停止中");}, // when the player returns a state of paused onPlayerBuffering:function(){updateHTML("バッファリング中");}, // when the player returns a state of buffering onPlayerCued:function(){updateHTML("キュー");}, // when the player returns a state of cued onQualityChange:function(quality){updateHTML("画質が変更されました");}, // a function callback for when the quality of a video is determined //エラー onErrorNotFound:function(){updateHTML("動画が見つかりません");}, // if a video cant be found onErrorNotEmbeddable:function(){updateHTML("埋め込みできません");} // if a video isnt embeddable }); function updateHTML(s){ $("#status").html(s); } }); </script> <!-- CSS --> <style type="text/css"> </style> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <h1>設置サンプル</h1> <p>参照:<a href='http://www.tikku.com/jquery-youtube-tubeplayer-plugin' target='_blank'>jQuery YouTube TubePlayer Plugin</a></p> <!-- CODE --> <div id='youtube-player-container'></div> <p> <a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("play")'>再生</a> <a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("pause")'>一時停止</a> <a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("stop")'>停止</a> <a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("mute")'>ミュート</a> <a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("unmute")'>ミュート解除</a> </p> <p>動画のスータス:<span id="status"></span></p> <!-- / CODE --> </body> </html>