Looping Videos
You can configure a video to loop in video player; meaning, the video restarts when it reaches the end. You enable the loop functionality by setting either the data-loop
or data-loop-with-controls
attribute to true
.
When the video loops, the player creates a loop event called window.PoWa.EVENTS.LOOP
. The event’s payload contains a loopCount
parameter that indicates how many times the video has looped.
You can also loop a raw PoWa implementation of the player.
Examples
Enable looping without displaying the controls
<div class="powa" org="test" uuid="abcd-1234-uuid" data-loop="true"></div>
Enable looping displaying the controls
<div class="powa" org="test" uuid="abcd-1234-uuid" data-loop-with-controls="true"></div>
Log looping
window.addEventListener('powaReady', event => { const powa = event.detail.powa;
powa.on(PoWa.EVENTS.LOOP, event => console.log(`Loop: ${ event.loopCount }`));});