Nov. 03, 2009Jared
My objective is redirect viewer to a web page upon the completion of a stream.
I have read several posts regarding redirect upon completion of a playlist.
Is this possible? Can you point me to some sample code?
Thanks,
jared
Nov. 03, 2009hobbs
Are you looking for code to detect the end of a live stream or a VOD streamed using RTMP or HTTP?
Nov. 03, 2009Jared
Thanks for the reply hobbs.
It is actually a simulated live stream. In other words, a prerecorded video that is being streamed as a live stream at a specific time.
Anyway, I found that the following code worked perfectly for anyone else who is searching for a similar solution.
<script type="text/javascript">
var player = null;
function playerReady(obj)
{
player = gid(obj.id);
addListeners();
};
function addListeners()
{
player.addModelListener('STATE', 'stateMonitor');
};
function stateMonitor(obj)
{
if(obj.newstate == 'COMPLETED')
{
// drop out of fullscreen
// this.window.focus();
// load a new page
window.location = 'http://www.google.com';
}
};
function gid(name)
{
return document.getElementById(name);
};
</script>
Here are some helpful links to learn more about the JW Player™:
Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!
If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.