Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Auto stop after x minutes + popup


Hi,

I need something what can stop watching stream video for all user at x minute of video (ex. 30) and then show popup (with text or img) inside player (the latter optionally). And video should be still locked after page refresh. Is it possible? I need it, because I want to sell premium accounts for this users who wants to view stream video without limits. I want to make money on my content. Script can block all wideos on my site for this user. And is it possible to auto unlock after 2h ?

Thanks in advance, and sorry for Englisch. :)

Paul

39 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

You can do this with onTime – http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference

JW Player

User  
0 rated :

I have the same problem but i have a script that fires a pop after the page is loaded

bc.. $(document).on('ready', contentLockerShow);


and this
bc.. function contentLockerShow(){
contentLockerBackground.animate({'opacity':'.6'}, 500);
contentLockerWrapper.fadeIn(500);
if(contentLockerCompleted == false){
contentLockerCompleted = true;
console.log(contentLockerCompleted);
}

}




and i use this code to make it hapen at second 20

bc.. jwplayer('screen').onTime(function(event) {
if (event.position > 20 && event.position < 20.4) {
contentLockerShow();
}
});



The code is working fine when i use it to pause the player but i dont know what to modify to pop 20 seconds after video play. I dont know javascript or jquery ... If someone can take a look im sure will take no more than 5 minutes to figure out.

Ethan Feldman

JW Player Support Agent  
0 rated :

Do you have a link?

JW Player

User  
0 rated :

Thank you for your time Ethan, i really appreciate it. Here is the link - http://video16.com/?p=5

Ethan Feldman

JW Player Support Agent  
0 rated :

Can you please remove the facebook pop up window?

JW Player

User  
0 rated :

how do you mean remove it ? that is the pop i wanna show when the player hit x second instead of pop up on page load. Soo i wanna change/ remove the on ready function and use something like

bc.. jwplayer('screen').onTime(function(event) {
if (event.position > 20 && event.position < 20.4) {
contentLockerShow();
}
});


Ethan Feldman

JW Player Support Agent  
0 rated :

Oh, got it, that box shows up when the page loads, so I thought that was something else. I will check this again.

Ethan Feldman

JW Player Support Agent  
0 rated :

Why not put the content locker show into the first event that pauses the player? You have two ontime events with the same timecodes.

JW Player

User  
0 rated :

Im very newbie into js but if use the logic you mean something like

bc.. jwplayer('screen').onTime(function(event) {
if (event.position > 40 && event.position < 40.4) {
contentLockerShow();
}
{
this.pause();
}
});


? Sure is no problem to make it like this

Ethan Feldman

JW Player Support Agent  
0 rated :

You have:

<script type='text/javascript'> jwplayer('screen').onTime(function(event) { if (event.position > 40 && event.position < 40.4) { this.pause(); } { contentLockerShow(); } }); </script>

It should be:

<script type='text/javascript'> jwplayer('screen').onTime(function(event) { if (event.position > 40 && event.position < 40.4) { this.pause(); contentLockerShow(); } }); </script>

JW Player

User  
0 rated :

i still dont understand something, this line calls the pop up ?

$(document).on('ready', contentLockerShow);


if i remove the line and with the above code the pop up should show on second 40 no ? But it doesent,

Ethan Feldman

JW Player Support Agent  
0 rated :

This line is making your content lock show when the page loads.

So you should have that removed, and then set the player code like this:

<script type='text/javascript'> jwplayer('screen').onTime(function(event) { if (event.position > 40 && event.position < 40.4) { this.pause(); contentLockerShow(); } }); </script>

JW Player

User  
0 rated :

yes but you see, if i remove that line i cannot click on the screen, so now i have the lock effect on the screen from second 1 without the pop up,

Ethan Feldman

JW Player Support Agent  
0 rated :

Where did you get this locking script from?

JW Player

User  
0 rated :

i paid someone to make me a php script into javascript, the php script costs 70$ and this javascript is not for sole it was a custom one made for me, so is a javascript clone of a php script, i wanted javascript beause i wanted to use php inside it

Ethan Feldman

JW Player Support Agent  
0 rated :

Ok. I am not sure how they set it up, though. Clearly the onTime is firing because the player stops at the right time.

JW Player

User  
0 rated :

Ok thank you very much Ethan for your time. Have a great day.

Ethan Feldman

JW Player Support Agent  
0 rated :

Np, you too.

JW Player

User  
0 rated :

Sorry Ethan. me again. i changed my aproach and set a timeout to contentLockerShow(); , now the content locker shows 20 seconds after the page loads, and i want to change the

<script type='text/javascript'>
jwplayer('screen').onTime(function(event) {
if (event.position > 40 && event.position < 40.4) {
this.pause();
}
});
</script>

to something like

<script type='text/javascript'>
jwplayer('screen').ready({
setTimeout(this.pause,20000)
</script>

soo the player should pause not on an event but 20 seconds after page loads, so will be synchronized with the pop, but i dont know the exact code i should use.

Ethan Feldman

JW Player Support Agent  
0 rated :

Why not just change your event to 20 and 20.4?

JW Player

User  
0 rated :

Because i will use php to insert those numbers and sometimes they will be like 600 seconds or even more, if the user will hit pause for 2 minutes and then play, the pop up will apear 2 minutes before the pause and i dont want that to happen. Also i want for the player to exit full screen if is in full screen.

I found this for full screen http://www.longtailvideo.com/support/forums/jw-player/javascript-interaction/33210/oncomplete-exit-fullscreen/

Soo the line
jwplayer('screen').setFullscreen(false);

should also be executed after x seconds

Ethan Feldman

JW Player Support Agent  
0 rated :

You can do that, but you need to use onTime() to say what time to use.

JW Player

User  
0 rated :

Ok i fixed the pause thing, i made the pop up to fire on jw time event, so now i only need the exit fullscreen

I tryed
bc.. jwplayer('screen').onTime(function(event) {
if (event.position > 20 && event.position < 20.4) {
setFullscreen(false);
document.exitFullscreen();
exitFullscreen();
exitFullscreen(true);
jwplayer('screen').setFullscreen(false);
}
});



also
bc.. jwplayer('scren').onPause(
function(evt) {
jwplayer('screen').setFullscreen(false);
}
);

Ethan Feldman

JW Player Support Agent  
0 rated :

setFullscreen only works in HTML5 mode.

JW Player

User  
0 rated :

I have set the player in html5 now but the event functions are not working anymore

Ethan Feldman

JW Player Support Agent  
0 rated :

Example ?

JW Player

User  
0 rated :

I set it up like this

bc.. <video id="screen" height="490" width="920" autoplay controls>
<source src="http://dl.dropboxusercontent.com/u/4462107/ihop1_1.mp4">
<p class="warning">Your browser does not support HTML5 video.</p>
</video>



http://video16.com/?p=14

Ethan Feldman

JW Player Support Agent  
0 rated :

This is a <video> tag, not the JW Player.

JW Player

User  
0 rated :

I was using this - http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/22644/using-the-html5-video-tag/

Now i have
bc.. <script type="text/javascript" src="/wp-content/themes/vid2/jw6/jwplayer.js"></script>

<video height="480" width="920" id="screen" autoplay controls>
<source src="http://dl.dropboxusercontent.com/u/4462107/ihop1_1.mp4" type="video/mp4">
</video>

<script type="text/javascript">
jwplayer("screen").setup({
modes: [
{ type: 'html5' },
{ type: 'flash', src: '/wp-content/themes/vid2/jw6/player.swf' }
]
});
</script>


but now is not working the player and i dont know why

Ethan Feldman

JW Player Support Agent  
0 rated :

Just embed using – http://www.longtailvideo.com/support/blog/15827/using-the-jw-embedder-to-embed-your-player, you don’t need to use a <video> tag.

JW Player

User  
0 rated :

My bad, i was thinking that is another code, still how do i run the player in html5 mode ? im using latest chrome on win7, exitfullscreen is a necesary function since the pop up will not apear if the player is in it.

JW Player

User  
0 rated :

Also according to documentation jw6 plays html in chrome when is mp4 but this doesent happen in my case, i use the latest chrome on win7 and when i disable javascript the player doesent show in my browser but if i go to direct link dl.dropboxusercontent.com/u/4462107/ihop1_1.mp4 the player is working

Ethan Feldman

JW Player Support Agent  
0 rated :

If you are using the player, it will play in either flash or html5 mode depending on what browser is used. Do you have a link to where it isn’t working in chrome?

JW Player

User  
0 rated :

Here - http://video16.com/?p=14

i use latest chrome, the player should use html5 and the player should exit full screen at second 20 if is in full screen but this doesent happen.

Ethan Feldman

JW Player Support Agent  
0 rated :

It doesn’t start in full screen mode though.

JW Player

User  
0 rated :

So the player needs to start in fullscreen to set the player to exit fullscreen on second x ? I was thinking if the user fullscreen the player on second 5 for example then the player should exit full screen on second 20, is this posssible with jw player ?

Ethan Feldman

JW Player Support Agent  
0 rated :

Yes because if you just let it run, it will never go into fullscreen.

JW Player

User  
0 rated :

here is how I exit the FS when using the JWP6.5.3609 and the JWP6.6.3846 versions.

<ol>
<li>enter the following under the events in the JWPlayer options as the last entry in the events
eliminates using a comma
bc.. onComplete: completeHandler


</li>
<li>
NOTE: there are several distinct obvious advantages when using the events Handlers

bc.. function completeHandler()
{
jwplayer("video").stop();
jwplayer("video").resize(w,h);
jwplayer("video").setup(options);
}



(a) the JWPlayer stops and unloads its contents
(b) the JWPlayer resizes to w,h dimensions
(c) the JWPlayer re-initializes

I'd would like to see LTV implement something like a reload() that will accomplish the above into a single step.

(ie)
bc.. function completeHandler()
{
jwplayer(ID).reload()
}



To see this in action visit my web site, www.starbase-alpha.com and then use the JWP6 conduit. In each of the examples you will be able to view the code used for that example by clicking on the 'view icon' on the page.

btw, this works well for BOTH modes namely; fullscreen and normalscreen.

Hope this is helpful

Ethan Feldman

JW Player Support Agent  
0 rated :

Thanks for sharing.

This question has received the maximum number of answers.