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