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

Ability to play video for a few seconds and then prompt for login


Hi.

Client wants to be able to play the first 45 seconds of any video while not logged in and then prompt non-logged i users for login. We are planning to use S2 Member Pro for the membership interface.

Does JW have hooks or settings to do this?

1 Community Answers

Todd

JW Player Support Agent  
0 rated :

We do not have built-in functionality for this, but you can certainly implement this using our Javascript API. There’s always more than one way to do things, but I would do something like this:

1) Start an ‘onTime’ event handler so the player starts counting
2) Check jwplayer().getPosition(); to detect the current time of the video
3) If the position is greater than 45, expose a CSS overlay requesting that the viewer log in

The code would look something like this:

jwplayer().on('time',function(){
	if (jwplayer().getPosition()>45) {
		jwplayer().stop(true);
		alert("You must log in to watch the rest of this video");
	}
});

You could also do something similar, but with a generic Javascript setTimeout() function that starts when the player fires the .on(‘firstFrame’) event.

This question has received the maximum number of answers.