How to loop a video in HTML5?

I have a requirement for a website I am developing where I want to play a video HTML player and it should be played in a loop, how can I achieve this?

AFAIK, the HTML5 <video> element supports this natively; without needing anything extra.

This should work -

<video src="..." controls loop></video>

The ‘controls’ attribute shows the controls (play, pause etc) on the video player and the ‘loop’ attribute will automatically loop the video infinite number of times. That’s the reason it’s a good idea to pair it with ‘controls’ attribute.

Really nice information.

I ultimately used javascript to listen for the videoEnd event and loop back to the beginning because, as far as I can tell, not all browsers support the loop attribute. I basically used a fallback image for mobile since iOS 5 doesn’t in any way, shape, or form enable autoplay for iOS devices.

I hope this command will work well for iPhone: