I want to limit the display of videos and photos per session. For example, a visitor watches 3 videos, and when he tries to watch the fourth video, he is redirected to the subscription page. I will use JWPlayer or my own HTML5, it does not matter, and it will work in WP, but looking at any way to do it with PHP (I am not an expert in any way).
So, ideally, this would be a workflow: 1) a visitor watches video1 → an optional message → you have 2 videos left 2) a visitor watches video2 → an optional message → you have 1 video 3) a visitor watches video3 → an optional message → you have 0 video 4) the visitor tries to watch the video4 → redirection
So far, I have found ways to limit bandwidth or time (only 1 video, and then redirect), but I need to serve exactly 3 videos, regardless of time and size, so these solutions will not work. Any idea on how to achieve this?
edit: here is some code to redirect, I really didn’t add anything, because nothing is what I need, but look:
<script src="text/javascript">
function vidplay(){
var video = document.getElementById('video');
video.play();
video.addEventListener('ended',function(){
window.location = 'http://SUBSCRIBE_PAGE';
});
}
</script>
<video controls id="video" width="640" height="360" onclick="vidplay()">
<source src="video/video.mp4" type="video/mp4" />
</video>
Devin source
share