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

Video repeat n times

I want my video to repeat 2 times i.e. plays once and then repeats 2 times for a total of playing 3 times.
I can get it to continuously play with the repeat="true" paramater but I want to limit the number of times it repeats.

1 Community Answers


JW Player Support Agent  
1 rated :

My suggestion would be to start a counter in an onBeforePlay() event and then increment it each time. When the counter is greater than three, stop the player:

<script src="jwplayer/jwplayer.js"></script><div id=test></div> <script> jwplayer('test').setup({ file: 'bunny.mp4', repeat: 'true' }); var counter = 0; jwplayer().onBeforePlay(function(){ counter++; console.log(counter); if (counter>3) { jwplayer().stop(); } }); </script>

This question has received the maximum number of answers.