How To Return Visitor To Starting Point When Video Ends

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
Well, assuming that your coding your own website, I'm sure there a is a php or javascript function, that searchs for when the video is finished, and if recalled true, it will revert to the last page. Sadly, I dont know php well enough to just tell you what to try, and I know Michael hasn't the time to learn php, so you might have to try googling something like this:

PHP function to return after video

And there are a million people usually asking for the same thing. I will research and tell you what I find. :)

(NOTE: for now, make sure to code a return link until this solution is figured out if your site is up. )
Thank you for responding.

Dewey
 

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
Okay. If you're talking about coding and java, that's way out of my expertise. Sorry.
Actually, I was hoping there might be an existing parameter that would accomplish the purpose since I'm not up to speed on Java, either. But thanks for trying to help anyway.

Dewey
 

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
heres the code that you will need to implement.

Code:
<script type='text/javascript' src='swfobject.js'></script>
  <div id='mediaspace'>This video requires Javascript and Flash</div>
  <script type='text/javascript'>
    var player = null;
    function playerReady(thePlayer) {
      player = document.getElementsByName('ply')[0];
        addListeners();
    }
    function stateMonitor(obj)
    {
      if(obj.newstate == 'COMPLETED')
      {
        // load a new page
        window.location = 'http://www.google.com';
      }
    };
    function addListeners() {
        if (player) { player.addModelListener("STATE", "stateMonitor"); }
        else { setTimeout("addListeners()",100); }
    }
    var s1 = new SWFObject('player.swf','ply','470','320','9','#ffffff');
    s1.addParam('allowfullscreen','false');
    s1.addParam('allowscriptaccess','always');
    s1.addParam('flashvars','file=http://uk.youtube.com/watch%3Fv%3DFgBUqJzgvBo&autostart=true');
    s1.write('mediaspace');
  </script>
Also here is the link to where I got the info, there are some instructions to setting it up. OFC this is much more complex than just using the embedded html youtube and it requires a different player (which is free for commercial use btw)

Hope this helped and here is the link: http://www.warriorforum.com/programming-talk/35546-redirect-another-url-after-embedded-youtube-video-ends-possible.html




Hehe, its javascript :D lol JKing though, ofc you wouldnt need to know any of this :)


EDIT: it would also be nice if you comment out the source to the code, seeing as you nor I came up with the code.

like this:

//(that guys username) from warriorforum.com
Alright. I"ll have a look at this. Thanks for your trouble.

Dewey
 

Bosco

MLG Player | aoX | UnDefined | ReBirth |
Joined
Mar 11, 2012
Messages
400
Reaction score
138
Age
27
Location
New York
Channel Type
Youtuber, Gamer, Commentator
I gave you the parameter though no?

Copy that code (the big box) and put it in a text file and call it return.js <-- thats what you save it as

Then, in the html file of the page with the video in the head tag copy and paste in the smaller code and change myfunction to whatever you named it (return.js)

so it should look like this in your html:

HTML:
<html>
 
<title> My Website </title>
 
<head>
 
<script type="text/javascript" src="return.js"></script>
 
</head>
 
<body>
 
<!-- your coding -->
next if you follow that link all you have to do is get that player which is just as easily embedded as a youtube video, but with more features such as this.

Sorry if it still doesn't make sense, but there is no CSS or HTML that I know to do that. PHP can do it, but Javascript is the easiest to work with in this situation.

Maybe when Michael comes on he will have a solution, but Im sure this is the easiest way to do what you want :)
 

Bosco

MLG Player | aoX | UnDefined | ReBirth |
Joined
Mar 11, 2012
Messages
400
Reaction score
138
Age
27
Location
New York
Channel Type
Youtuber, Gamer, Commentator
Alright. I"ll have a look at this. Thanks for your trouble.

Dewey

No problem and also read the above post, because it gives further instructions :)
 

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
Also to the OP in case you were wondering, you can put this script in the top of your doc, or you can put it in a different file and save a a .js file and then link it in so it can be used on all of your pages. Hope this helps you out :)

Heres the code to link in your JS document:

Code:
<script type="text/javascript" src="myscript.js"></script>
 
//Change the code in the src to the name of your
//javascript file like this "return.js" or something
Thanks much for your help.

Dewey
 

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
I gave you the parameter though no?

Copy that code (the big box) and put it in a text file and call it return.js <-- thats what you save it as

Then, in the html file of the page with the video in the head tag copy and paste in the smaller code and change myfunction to whatever you named it (return.js)

so it should look like this in your html:

HTML:
<html>
 
<title> My Website </title>
 
<head>
 
<script type="text/javascript" src="return.js"></script>
 
</head>
 
<body>
 
<!-- your coding -->
next if you follow that link all you have to do is get that player which is just as easily embedded as a youtube video, but with more features such as this.

Sorry if it still doesn't make sense, but there is no CSS or HTML that I know to do that. PHP can do it, but Javascript is the easiest to work with in this situation.

Maybe when Michael comes on he will have a solution, but Im sure this is the easiest way to do what you want :)

Got it. Thanks!

Dewey
 

Bosco

MLG Player | aoX | UnDefined | ReBirth |
Joined
Mar 11, 2012
Messages
400
Reaction score
138
Age
27
Location
New York
Channel Type
Youtuber, Gamer, Commentator
No problem man, and welcome to the forums, just noticed your message count. Your brand new :)
 

Michael

I Love YTtalk
Joined
Aug 31, 2011
Messages
22,357
Reaction score
16,029
Channel Type
Youtuber
I would implement as Bosco has posted myself if that works how you want it, either that or you could opt to use meta refresh, it isnt the best thing to use though as you would need to manually enter the end time of the video and URL to redirect to and search engines I dont think they follow meta refresh and it isnt very user friendly forcing them to a new page.

HTML:
<meta http-equiv="refresh" content="300;url=http://whatever.com/thenextpage/" />
Where the 300 is, that would be how long after the page has loaded before sending them to the next page in seconds. Say the video is 300 seconds long, you would use 300 there.

You can use that anywhere between the two head tags in your HTML, are you using a CMS for this or is this a static website? As meta refresh will not work well at all if you are using say Wordpress, Joomla or Drupal etc

So yeah Boscos posts will perform much better than that and should be more user friendly and less of an upkeep for yourself in the future. Good luck with this by the way.

EDIT: Before considering to use the meta refresh one it is probably best for you to read this too as it warns of the potential issues of using it:

http://www.seroundtable.com/archives/022447.html
 

Bosco

MLG Player | aoX | UnDefined | ReBirth |
Joined
Mar 11, 2012
Messages
400
Reaction score
138
Age
27
Location
New York
Channel Type
Youtuber, Gamer, Commentator
Michael, sorry for off topic but read my title :)

And also, I had no clue about the refresh variable, but wouldnt that be hard to implement for slower connections that are buffering the video? or even have it paused? because that would be very annoying to be buffering and then get whisked away because your "seconds" are over.