0

I want to dynamically play one iframe src after the other. These are videos but do not have an extension of .mp4 or any video formats. For example I am using YouTube embeds below.

Thank you for your help.

<iframe id="example_frame_1" width="100%" height="100%" src= "https://www.youtube.com/embed/EcJwUCJvU7I?autoplay=1" onended="run()"/>

<script>
    iframe = document.getElementById("example_frame_1");

    function run(){

        var nextFrame = "https://www.youtube.com/embed/EcJwUCJvU7I?autoplay=1";
        iframe.src = nextFrame;
    };
</script>
Will P.
  • 8,437
  • 3
  • 36
  • 45
Ravi
  • 1
  • 2
  • 1
    What is not working as you expect? Provide your expected output and any error messages you receive – WillardSolutions Dec 22 '16 at 18:31
  • This might help http://stackoverflow.com/questions/27073494/can-javascript-detect-when-an-embedded-youtube-video-has-ended – Searching Dec 22 '16 at 18:37
  • @EatPeanutButter:I have two videos embed in iframe source. Both should play one after the other. Currently only first video is playing and the second video is not working. – Ravi Dec 22 '16 at 20:29

0 Answers0