Try to experiment with this:
Code:
<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>YouTube Demo</title>
<style>
body {font-family: arial; font-size: 13px; padding:0px; margin: 0px; background: #dedede; }
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://www.youtube.com/player_api"></script>
<script>
// This part of the script by jscheuer1. Works in Firefox, Chrome, IE 8 and up, Opera. Page must be live in order for the script to work with IE.
var controllable_player,
statechange = function(e){
if(e.data === 0){controllable_player.stopVideo()}
};
function onYouTubeIframeAPIReady() {
controllable_player = new YT.Player('controllable_player', {events: {'onStateChange': statechange}});
}
if(window.opera){
addEventListener('load', onYouTubeIframeAPIReady, false);
}
setTimeout(function(){
if (typeof(controllable_player) == 'undefined'){
onYouTubeIframeAPIReady();
}
}, 3000)
</script>
<script>
function load_video(url, sstart, eend)
{start=sstart; end=eend;
maximize();
document.getElementById('the_container').style.display='block'
document.getElementById('controllable_player').style.height='100%'
uurl=url;
setTimeout("if(controllable_player.loadVideoById){controllable_player.loadVideoById('IBRqwnGferM', 0, 'large')}",0)
setTimeout("controllable_player.loadVideoById({'videoId': uurl, 'startSeconds': start, 'endSeconds': end, 'suggestedQuality': 'large'})",6000)
document.getElementById('stop').style.display='block'
document.getElementById('plus').style.display='block'
document.getElementById('minus').style.display='block'
document.getElementById('info').style.display='block'
document.getElementById('info').innerHTML=info
}
function load_playlist(url_playlist)
{
maximize();
document.getElementById('the_container').style.display='block'
document.getElementById('controllable_player').style.height='100%'
uurl_playlist=url_playlist;
setTimeout("controllable_player.loadVideoById('IBRqwnGferM')",0);
setTimeout("controllable_player.loadPlaylist(uurl_playlist)",6000);
setTimeout("controllable_player.setPlaybackQuality('large')",6000)
document.getElementById('stop').style.display='block'
document.getElementById('plus').style.display='block'
document.getElementById('minus').style.display='block'
document.getElementById('info').style.display='block'
document.getElementById('info').innerHTML=info
}
function unload_video()
{
document.getElementById('the_container').style.left='50%';
document.getElementById('the_container').style.top='-100%';
document.getElementById('the_container').style.right='50%';
document.getElementById('the_container').style.bottom='50%';
if(controllable_player.seekTo)controllable_player.seekTo(0);
if(controllable_player.pauseVideo)controllable_player.pauseVideo();
document.getElementById('controllable_player').style.height='1px'
document.getElementById('stop').style.display='none'
document.getElementById('plus').style.display='none'
document.getElementById('minus').style.display='none'
document.getElementById('info').style.display='none'
}
function minimize()
{
document.getElementById('the_container').style.left='35%';
document.getElementById('the_container').style.top='80px';
document.getElementById('the_container').style.right='35%';
document.getElementById('the_container').style.bottom='70%';
}
function maximize()
{
document.getElementById('the_container').style.left='50px';
document.getElementById('the_container').style.top='60px';
document.getElementById('the_container').style.right='50px';
document.getElementById('the_container').style.bottom='160px';
}
</script>
</head>
<body >
<div style="position: absolute; left: 50px; top: 60px; right: 50px; bottom: 110px; background: black; color: white; ">
<div style="position: absolute; top: 50%; left: 50%; margin-left:-80px">Select a video at the bottom</div>
</div>
<div style="position: relative; top: 10px; text-align: center; font-size:30px">YouTube Demo</div>
<div id="the_container" style="display:none;position: absolute; left:40px; top: 0px; right: 40px; bottom: 100px; z-index:20; border: 0px solid red"><div style="position:absolute;z-index:8; width: 100%; height:0px; margin-top: 2px"><div id="stop" style="float: right; background: darkred; color: white; font-family: verdana; font-size: 14px; font-weight: bold; cursor: pointer" onclick="unload_video()"> X </div><div id="plus" style="float: right;margin-right:1px; background: darkred; color: white; font-family: verdana; font-size: 14px; font-weight: bold; cursor: pointer" onclick="maximize()"> + </div><div id="minus" style="float: right;margin-right:1px; background: darkred; color: white; font-family: verdana; font-size: 14px; font-weight: bold; cursor: pointer; z-index:10" onclick="minimize()"> - </div></div><div id="info" style="background:darkred; border: 0px solid silver; border-right: 0px;border-bottom: 0px; width: 100%; color: white; position: absolute; z-index:7; height:50px; text-align: center; padding-top: 10px; padding-bottom: 5px; font-family: arial; font-size:12px;overflow: auto">No info about video</div><br><br><br><iframe id="controllable_player" name="controllable_player" style="position: absolute; height: 100%; width: 100%;z-index:20" src="http://www.youtube.com/watch_popup?v=IBRqwnGferM&vq=large" frameborder="0"></iframe></div>
<div style="position: absolute; width: 560px; left: 50%; margin-left: -280px; bottom: 5px; overflow-x: auto; overflow-y: hidden">
<div style="position:relative; display: inline">
<img src="http://i3.ytimg.com/vi/YpX9eFhV6kg/mqdefault.jpg" alt="" title="Click to play video" style="position: relative; height:95px; width: 180px; border: 1px solid black; cursor: pointer" onclick="info='Homo habilis';load_video('YpX9eFhV6kg')">
</div>
<div style="position:relative; display: inline">
<img src="http://i3.ytimg.com/vi/WVSbl-sNi5Y/mqdefault.jpg" alt="" title="Click to play video" style="position: relative; height:95px; width: 180px; border: 1px solid black; cursor: pointer" onclick="info='Homo heidelbergensis (in German)<br>Starts at 50 secs, plays for 100 secs';load_video('WVSbl-sNi5Y', 50,150)">
</div>
<div style="position:relative; display: inline">
<img src="http://i3.ytimg.com/vi/sHy9FOblt7Y/mqdefault.jpg" alt="" title="Click to play video" style="position: relative; height:95px; width: 180px; border: 1px solid black; cursor: pointer" onclick="info='The Neanderthal Flute';load_video('sHy9FOblt7Y')">
</div>
</div>
</body>
</html>
Bookmarks