User:Lemursrule/sandbox5

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   YouTube Embedded Player Example page   body { font-family: verdana, helvetica; background-color: white; }   #timedisplay { border: solid 1px red; width: 50px; }    function updateHTML(elmId, value) { document.getElementById(elmId).innerHTML = value; }       function setytplayerState(newState) { updateHTML("playerstate", newState); }       function onYouTubePlayerReady(playerId) { ytplayer = document.getElementById("myytplayer"); setInterval(updateytplayerInfo, 250); updateytplayerInfo; ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); ytplayer.addEventListener("onError", "onPlayerError"); }       function onPlayerError(errorCode) { alert("An error occured: " + errorCode); }       function onytplayerStateChange(newState) { setytplayerState(newState); }       function updateytplayerInfo { updateHTML("bytesloaded", getBytesLoaded); updateHTML("bytestotal", getBytesTotal); updateHTML("videoduration", getDuration); updateHTML("videotime", getCurrentTime); updateHTML("startbytes", getStartBytes); updateHTML("volume", getVolume); }       // functions for the api calls function loadNewVideo(id, startSeconds) { if (ytplayer) { ytplayer.loadVideoById(id, parseInt(startSeconds)); }       }        function cueNewVideo(id, startSeconds) { if (ytplayer) { ytplayer.cueVideoById(id, startSeconds); }       }        function play { if (ytplayer) { ytplayer.playVideo; }       }        function pause { if (ytplayer) { ytplayer.pauseVideo; }       }        function stop { if (ytplayer) { ytplayer.stopVideo; }       }        function getPlayerState { if (ytplayer) { return ytplayer.getPlayerState; }       }        function seekTo(seconds) { if (ytplayer) { ytplayer.seekTo(seconds, true); }       }        function getBytesLoaded { if (ytplayer) { return ytplayer.getVideoBytesLoaded; }       }        function getBytesTotal { if (ytplayer) { return ytplayer.getVideoBytesTotal; }       }        function getCurrentTime { if (ytplayer) { return ytplayer.getCurrentTime; }       }        function getDuration { if (ytplayer) { return ytplayer.getDuration; }       }        function getStartBytes { if (ytplayer) { return ytplayer.getVideoStartBytes; }       }        function mute { if (ytplayer) { ytplayer.mute; }       }        function unMute { if (ytplayer) { ytplayer.unMute; }       }        function getEmbedCode { alert(ytplayer.getVideoEmbedCode); }       function getVideoUrl { alert(ytplayer.getVideoUrl); }       function setVolume(newVolume) { if (ytplayer) { ytplayer.setVolume(newVolume); }       }        function getVolume { if (ytplayer) { return ytplayer.getVolume; }       }        function clearVideo { if (ytplayer) { ytplayer.clearVideo; }       }        function onytplayerStateChange(newState) { if(newState == 0) { window.location.href = 'http://yoursite.com/next.html'; }           //alert("Player's new state: " + newState); }     You need Flash player 8+ and JavaScript enabled to view this video.  // <![CDATA[ // allowScriptAccess must be set to allow the Javascript from one // domain to access the swf on the youtube domain var params = { allowScriptAccess: "always", bgcolor: "#cccccc" }; // this sets the id of the object or embed tag to 'myytplayer'. // You then use this id to access the swf and make calls to the player's API var atts = { id: "myytplayer" }; swfobject.embedSWF("http://www.youtube.com/v/ma9I9VBKPiw&amp;border=0&amp;enablejsapi=1&amp;playerapiid=ytplayer",                        "ytapiplayer", "425", "344", "8", null, null, params, atts); //]]>     Player state: --

Play | Pause | Stop | Mute | Unmute

<form action="" onsubmit="seekTo(document.getElementById('seekto').value); return false;"> <input id="seekto" type="text" size="4" /><input type="submit" value="Seek to" />

Duration: --:-- | Current Time: --:--

Bytes Total: -- | Start Bytes: -- | Bytes Loaded: --

<input type="text" size="11" id="loadvideoid" value="u1zgFlCw8Aw" /> &lt;- Load video</a> | Start at: <input type="text" size="4" id="startseconds" value="0" />

<input id="vol" type="text" size="2" /> &lt;- Set Volume</a> | Volume: --

<input type="text" size="11" id="cuevideoid" value="u1zgFlCw8Aw" /> &lt;- Cue video</a> | Start at: <input type="text" size="4" id="startseconds2" value="0" />

Get Embed Code</a> | Get Video URL</a> | Clear Video</a>