0

I have a video in an iframe (the video is from my domain) I want the video to repeat after it finishes.

<iframe src="video/video1.mp4" width="100px" height="100px" allowullScreen></iframe>

Please help.

Thanks in advance!

Daniel Causebrook
  • 469
  • 1
  • 8
  • 20
Saurabh Mahajan
  • 2,937
  • 7
  • 25
  • 32
  • 2
    Have you tried anything at all that you want to share with us? Is the content in the iframe from the same domain as you or is it from another website? – Equalsk Jul 16 '15 at 14:21
  • 1
    Questions that consist of 2 lines of text, do not have a question mark and do not contain any code are very bad candidates for an answer. – blex Jul 16 '15 at 14:24
  • @Equalsk: the video is from same website means from same domain – Saurabh Mahajan Jul 16 '15 at 14:25
  • Good, at least this should be possible then. Have you tried anything so far? Look at [this SO post](http://stackoverflow.com/questions/1088544/javascript-get-element-from-within-an-iframe) and figure out how to get the player element from the iframe, then go from there. – Equalsk Jul 16 '15 at 14:30
  • 1
    Could you provide more information? It's nearly impossible to answer this question as it stands, because you give nothing that we can look at and help you with. What is the code are you using? What have you been trying? – Daniel Causebrook Jul 16 '15 at 14:31
  • @Dan300 : I added iframe html – Saurabh Mahajan Jul 16 '15 at 14:36
  • @Dan300 : I updated question with html please do the needful. – Saurabh Mahajan Jul 16 '15 at 14:40
  • @Saurabh Mahajan Thanks, it's much clearer now. – Daniel Causebrook Jul 16 '15 at 14:52

2 Answers2

3

you provided the following code:

<iframe src="video/video1.mp4" width="100px" height="100px" allowFullScreen></iframe>

in order to let it repeat itself just do the following:

<video style="width: 100px; height: 100px" controls loop>
    <source src="video/video1.mp4" type="video/mp4">
    Your browser does not support playing this Video
</video>
Jee Mok
  • 6,157
  • 8
  • 47
  • 80
GottZ
  • 4,824
  • 1
  • 36
  • 46
2

I think it would be better if, instead of using the iframe tag (which is for displaying webpages not content like videos), you use the HTML5 <video> tag. This is better because it allows you to loop the video easily, without js even, and allows much greater control. It also has a better UI.

<video width="320" height="240" loop autoplay>
  <source src="video/video1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

That's all you need!

EDIT:

If you want to customise the video there may be other attributes you find useful:

<video ... loop ... > : loops the video.

<video ... autoplay ... > : starts the video automatically.

<video ... controls ... > : adds controls on the bottom of the video so the user can play and pause the video etc.

<video ... muted ... > : mutes the video so no sound is played.

Daniel Causebrook
  • 469
  • 1
  • 8
  • 20