参照:Making a Custom YouTube Video Player With YouTube’s APIs
<!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="/content/lib/jquery/jquery.swfobject.1-1-1.min.js"></script>
<script type="text/javascript" src="/content/lib/jquery/youTubeEmbed-jquery-1.0.js"></script>
<script type="text/javascript">
$(function(){
$('#player1').youTubeEmbed('http://www.youtube.com/watch?v=9YEEl52u8XE');
$('#player2').youTubeEmbed({
video:'http://www.youtube.com/watch?v=8e_wXc0m97w',
width:320, // Height is calculated automatically
progressBar:false // Hide the progress bar
});
$('#player3').youTubeEmbed({
video:'http://www.youtube.com/watch?v=GILIk8W00s4',
width:320, // Height is calculated automatically
progressBar:true // Hide the progress bar
});
});
</script>
<!-- CSS -->
<style type="text/css">
.flashContainer{
position:relative;
overflow:hidden;
}
.progressBar{
display:none;
position:absolute;
width:auto;
height:8px;
left:20px;
right:105px;
bottom:20px;
background-color:#141414;
overflow:hidden;
cursor:pointer;
/* A light CSS3 bottom highlight */
-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.3);
-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.3);
box-shadow:0 1px 0 rgba(255, 255, 255, 0.3);
}
.progressBar .elapsed{
position:absolute;
width:0;
height:100%;
background-color:#1fa2f6;
border-right:1px solid #49AFF0;
}
.controlDiv{
/* Centering the control div */
position:absolute;
width:120px;
height:120px;
cursor:pointer;
top:50%;
left:50%;
margin:-60px 0 0 -60px;
}
.controlDiv.play{
background:url(/content/img/ajax/play.png) no-repeat center center;
}
.controlDiv.replay{
background:url(/content/img/ajax/replay.png) no-repeat center center;
}
.controlDiv.pause{
background:url(/content/img/ajax/pause.png) no-repeat -99999px;
}
.flashContainer:hover .controlDiv.pause{
background-position:center center;
}
/* Only show the progress bar when the video is playing */
.flashContainer.playing:hover .progressBar{
display:block;
}
</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://tutorialzine.com/2010/07/youtube-api-custom-player-jquery-css/' target='_blank'>Making a Custom YouTube Video Player With YouTube’s APIs</a></p>
<!-- CODE -->
<h2>デフォルト</h2>
<p id="player1"></p>
<h2>プログレスバー無、プレーヤーの幅指定</h2>
<p id="player2"></p>
<h2>プログレスバー有、プレーヤーの幅指定</h2>
<p id="player3"></p>
<!-- / CODE -->
</body>
</html>