HDW Player Download

Javascript API Examples

HDW Player is still trying to better the Examples section. Mail your ideas to [email protected]

 

<html>
<head>
<title>Sample Integration</title>
<script type="text/javascript" src="/media2/js/hdwplayer.js"></script>
<script>
function onPlayerReady() {
	player = document.getElementById('player');
	player.addEventListener("onStateChange",onStateChange);
	player.addEventListener("onError",onError);
}

function onStateChange(e){
	document.getElementById('log').value += 'onStateChange : ' + e.data + '\n';
}

function onError(e){
	document.getElementById('log').value += 'onError : ' + e.data + '\n';
}
</script>
</head>
<body>
<div id="player"></div>
<script>
hdwplayer({ 
	id       : 'player_div',
	swf      : '/media2/files/player.swf?api=true',
	width    : '640',
	height   : '360',
	config   : 'player/xml/config.xml'
});
</script>
<div style="margin:0px; padding:0px">
  <textarea name="log" id="log" cols="77" rows="10" ></textarea>
</div>
<div style="font-family:Arial, Helvetica, sans-serif; float:left;">
<a href="javascript:void(0);" onClick="player.playVideo();">Play</a>
<a href="javascript:void(0);" onClick="player.pauseVideo();">Pause</a> 
<a href="javascript:void(0);" onClick="player.stopVideo();">Stop</a>  
<a href="javascript:void(0);" onClick="player.seekTo(10);">SeekTo</a> 
<a href="javascript:void(0);" onClick="player.mute();">Mute</a>
<a href="javascript:void(0);" onClick="player.unMute();">UnMute</a>
<a href="javascript:void(0);" onClick="player.setVolume(20);">setVolume</a>  
<a href="javascript:void(0);" onClick="alert(player.getVolume());">getVolume</a> 
<a href="javascript:void(0);" onClick="alert(player.getBytesLoaded());">getBytesLoaded</a>
<br /><br />
<a href="javascript:void(0);" onClick="alert(player.getBytesTotal());">getBytesTotal</a>
<a href="javascript:void(0);" onClick="alert(player.getCurrentTime());">getCurrentTime</a>  
<a href="javascript:void(0);" onClick="alert(player.getDuration());">getDuration</a> 
<a href="javascript:void(0);" onClick="player.destroy();">destroy</a> 
</div>
</html>

 

Support