Go
Not registered? Sign up!

Loading a Page After Video Done

Google Translate
9 posts | return to the JavaScript Interaction forum | get the rss feed for this thread

Sep. 23, 2009Heem

Hi can someone help me figure out how to have the page redirect to a new page after a video is completed. I have the video loading in two different instances. One is right from the the index.html and another from a XML.

Thanks!

Sep. 23, 2009lost

 
See: http://www.longtailvideo.com/support/forum/JavaScript-Interaction/19638/Javascript-api-none-of-the-functions-work#msg131781

Or: http://www.longtailvideo.com/support/forum/JavaScript-Interaction/19590/url-after-video-ends#msg131540

Or: http://www.longtailvideo.com/support/forum/JavaScript-Interaction/17072/Action-when-Video-Ends#msg128960

Or: http://www.longtailvideo.com/jw/?search=oncompleted

Sep. 24, 2009Heem

Unfortunelty Non of that work, I didnt know where to put the playerid and such. Very confused

Sep. 24, 2009lost

 
Those links go to complete, working pages that you can simply copy & paste.

What more do you need?

Sep. 24, 2009Heem

I added that line of code but was a bit confused on where to put the playerid

Sep. 24, 2009lost

It's not a line of code. It's the whole page.

Then you need to adjust all of your settings for your site and media files.

Sep. 24, 2009Heem

sorry for the misunderstand, when I mean the line of code I mean th enetire box of code that wa sposted. Where in it would replace it with my own player ID?

Oct. 12, 2009Tom

Is there any chance somone has a mirror or could someone post the whole code fot this page?
http://willswonders.myip.org:8074/Simple_OnCOMPLETED.html

Thanks

Oct. 12, 2009SMack

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<title>Simple On COMPLETED - JWMP v4.6.x - swfobject v2.2</title>

<script src="http://www.google.com/jsapi"></script>

<script>
google.load('swfobject', '2.2');
</script>

<script type="text/javascript">
var flashvars =
{
'file': '/video/ThingsFallApart.flv',
'stretching': 'uniform',
'frontcolor': '86C29D', // text & icons (green)
'backcolor': '003367', // playlist background (blue)
'lightcolor': 'C286BA', // selected text/track highlight (red)
'screencolor': 'FFFFFF', // screen background (black)
'id': 'playerID',
'autostart': 'true'
};

var params =
{
'allowfullscreen': 'true',
'allowscriptaccess': 'always',
'bgcolor': '#FFFFFF'
};

var attributes =
{
'id': 'playerID',
'name': 'playerID'
};

swfobject.embedSWF('player-4.6.397.swf', 'player', '500', '301', '9.0.124', false, flashvars, params, attributes);
</script>

<script type="text/javascript">
var player = null;
var playlist = null;


function playerReady(obj)
{
player = gid(obj.id);
addListeners();
};


function addListeners()
{
playlist = player.getPlaylist();

if(playlist.length > 0)
{
player.addModelListener('STATE', 'stateMonitor');
player.addModelListener('TIME', 'timeMonitor');
}
else
{
setTimeout("addListeners();", 100);
}
};


function stateMonitor(obj)
{
if(obj.newstate == 'COMPLETED')
{
//...load a new page when the media file completes playing
document.location = 'http://www.google.com';
}
};


function timeMonitor(obj)
{
if(obj.position > 20.0)
{
//...load a new page when the media file plays to 20.0 seconds
player.sendEvent('STOP');
document.location = 'http://www.google.com';
}
};


function gid(name)
{
return document.getElementById(name);
};
</script>

</head>

<body>

<div id="playercontainer" class="playercontainer"><a id="player" class="player" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Flash Plugin to see this video.</a></div>

</body>

</html>

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? 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.