//------------------------------------- // MAIN VARIABLES //------------------------------------- var SWFID; // Must be set to id of swf var obj = new Object; //------------------------------------ // UTILITY METHODS //------------------------------------ function checkObj () { if (SWFID) { createObj(); return true; } else{ alert("fooTubeLoader: to call methods within a swf set the variable \"SWFID\"!"); return false; } } function createObj () { obj = document.getElementById(SWFID); } //------------------------------------ // FOOTUBE EVENT METHODS //------------------------------------ function onYouTubePlayerReady(playerId) { if (checkObj()) { obj.addEventListener("onStateChange", "onytplayerStateChange"); } } function onytplayerStateChange(newState) { obj.playerStateUpdateHandler(newState); } //------------------------------------ // FOOTUBE METHODS //------------------------------------ function loadVideoById(id, startSeconds) { if (checkObj()) { obj.loadVideoById(id,startSeconds); } } function cueNewVideo(id, startSeconds) { if (checkObj()) { obj.cueVideoById(id, startSeconds); } } function clearVideo() { if (checkObj()) { obj.clearVideo(); } } function setSize(w, h) { if (checkObj()) { obj.setSize(w, h); } } function play() { if (checkObj()) { obj.playVideo(); } } function pause() { if (checkObj()) { obj.pauseVideo(); } } function stop() { if (checkObj()) { obj.stopVideo(); } } function seekTo(seconds) { if (checkObj()) { obj.seekTo(seconds, true); } } function getPlayerState() { if (checkObj()) { return obj.getPlayerState(); } } function getBytesLoaded() { if (checkObj()) { return obj.getVideoBytesLoaded(); } } function getBytesTotal() { if (checkObj()) { return obj.getVideoBytesTotal(); } } function getCurrentTime() { if (checkObj()) { return obj.getCurrentTime(); } } function getDuration() { if (checkObj()) { return obj.getDuration(); } } function getStartBytes() { if (checkObj()) { return obj.getVideoStartBytes(); } } function setVolume(newVolume) { if (checkObj()) { obj.setVolume(newVolume); } } function getVolume() { if (checkObj()) { return obj.getVolume(); } } function mute() { if (checkObj()) { obj.mute(); } } function unMute() { if (checkObj()) { obj.unMute(); } } function getEmbedCode() { if (checkObj()) { return obj.getVideoEmbedCode(); } } function getVideoUrl() { if (checkObj()) { return obj.getVideoUrl(); } }