0

I want to play alloy ui video to be repeated once it finish, below is my the code any help will be appreciated

<div id="myVideo"></div>
<script>
AUI().use(
'aui-video',
function(A) {
var video = new A.Video(
    {
        boundingBox: '#myVideo',
        fixedAttributes: {
        allowfullscreen: 'true'
    },
    ogvUrl: 'http://videos.liferay.com/lifecasts/portal/6.0/106.ogv',
    swfUrl: 'http://videos.liferay.com/common/player.swf',
    poster: '/documents/10184/22494/home1.jpg',
    url: '/documents/10184/21495/ACC+Drive+7-28_h264_2.mp4',
    }
).render();
video.play();
});

C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65
Muhammad Essa
  • 142
  • 1
  • 10

2 Answers2

0

Since your actual video element is wrapped inside that div with id myVideo. All you need to do is get that video element and add a listener to it. Mozilla has a really good documentation on Media events and the one you are looking for is

ended : Sent when playback completes.

So, you need to find the video element inside that div may be using a querySelector or any other library function if you are using JQuery.

Once you have the video element, just add a listener to it. (Assuming videoElement is the DOM node you found.

videoElement.addEventListener("ended", function() {
   //Replay your video here
}, true);

Hope it helps.

Vivek Pradhan
  • 4,777
  • 3
  • 26
  • 46
0

You can simply add the loop element to your HTML code as loop="true" or loop="loop". If you want to do it in JQuery, you can write the code as $(".myVideo").attr('loop','loop');