How To Return Visitor To Starting Point When Video Ends

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
I have embedded a video on my site that I want to choose the thumbnail picture for. As you know, YouTube gives you 3 choices of thumbs when you upload a video, and they may not contain one you want. So, I have a thumb of my choosing on my home page with a link that takes the visitor to another page containing the video. Once the video ends, I'd like for the system to take the visitor back to the original starting point they called the video from so they can continue browsing my site uninterrupted.

I realize I can do that by simply having a return link on the video page. But my question is, is there some code, or a parameter, that will automatically key on the end of the video and do that for me? It's much slicker that way, and more professional.

Thanks!
Dewey
 

ForeverAlonePrick

I don't know what's going on.
Joined
Apr 2, 2012
Messages
4,037
Reaction score
1,289
Age
31
Channel Type
Vlogger
Let me make sure I understand you. Somebody is watching your video, and then you want it to start up again from the beginning? Is that it?
 

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
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. )
 

ForeverAlonePrick

I don't know what's going on.
Joined
Apr 2, 2012
Messages
4,037
Reaction score
1,289
Age
31
Channel Type
Vlogger
Okay. If you're talking about coding and java, that's way out of my expertise. Sorry.
 

ForeverAlonePrick

I don't know what's going on.
Joined
Apr 2, 2012
Messages
4,037
Reaction score
1,289
Age
31
Channel Type
Vlogger
Oh, I wish you best of luck though!;)
 

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
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


Oh, I wish you best of luck though!;)
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
 
  • Like
Reactions: ForeverAlonePrick

ForeverAlonePrick

I don't know what's going on.
Joined
Apr 2, 2012
Messages
4,037
Reaction score
1,289
Age
31
Channel Type
Vlogger
Hehe, its javascript :D lol JKing though, ofc you wouldnt need to know any of this :)
There you go, showing me up, making a fool out of me :mad:
Just kidding, I'm proud of my ignorance! It's like a badge of honor for me. That's terrible, but who cares?
 

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
:) Lol, just trying to help ya out :)

And if you ever wanted a website you make yourself for your youtube channel, this is the nitty gritty stuff ^^
 
  • Like
Reactions: ForeverAlonePrick

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
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
 
  • Like
Reactions: ForeverAlonePrick

Dewey

Member
Joined
May 10, 2012
Messages
8
Reaction score
0
Let me make sure I understand you. Somebody is watching your video, and then you want it to start up again from the beginning? Is that it?
Not quite. Let's say they click a link on page 1 to see a video. That takes them to page 2 where the video is. It plays. When it stops, I'd like the system to automatically switch back to the spot on page 1 where they first clicked the link to see the video.