1/** 2 * playlist.js 3 * 4 * This belongs to the flowplay2 plugin for dokuwiki. It is somewhat based on the 5 * embeding example on flowplayer.org. 6 * 7 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 8 * @version 0.3 9 * @author bSpot <blind@bspot.de> 10 */ 11 12// Flowplayer configuration 13var playerConfig = 14{ 15 controlBarBackgroundColor: '0x99cddc' 16} 17 18var embedConfig = 19{ 20 bgcolor:'#6F7485', 21 width: 320, 22 height: 240 23} 24 25// variable that holds the player API. it is initially null 26var flowplayerobject = null; 27 28 29// runs url in flowplayer 30function runFlowPlayer(url) 31{ 32 // set URL 33 playerConfig.videoFile = url; 34 35 // if flowplayer is not loaded. load it now. 36 if (flowplayerobject == null) 37 { 38 // create Flowplayer instance into DIV element whose id="player" 39 // Flash API is automatically returned (flashembed.js ver. 0.27) 40 flowplayerobject = flashembed 41 ( 42 "flowplayer", 43 embedConfig, 44 {config: playerConfig} 45 ); 46 47 } 48 // flowplayer is already loaded - now we simply call setConfig() 49 else 50 { 51 flowplayerobject.setConfig(playerConfig); 52 } 53} 54 55 56window.onload = function() 57{ 58 var links = document.getElementsByTagName("a"); 59 for (var i = 0; i < links.length; i++) 60 { 61 if (links[i].className == "flowplayitem") 62 { 63 links[i].onclick = function() 64 { 65 playerConfig.autoPlay = true; 66 runFlowPlayer(this.getAttribute("href")); 67 68 // disable link's default behaviour 69 return false; 70 } 71 } 72 } 73 74 // start player if url is given 75 if (playerConfig["videoFile"]) 76 runFlowPlayer(playerConfig["videoFile"]); 77 78 // when user presses splash image it triggers our first playlist entry 79 if (document.getElementById("splash")) 80 document.getElementById("splash").onclick = function() 81 { 82 links[0].onclick(); 83 } 84} 85 86