Skip to main content
Inspiring
November 29, 2016
Answered

How to add a "ended" event listener to HTML5 video in Animate CC?

  • November 29, 2016
  • 1 reply
  • 2730 views

I added a video as a DOM, it works wonderfully, triggers when I need it to, but I cant find a way to listen to when the video is finished.

Traditional myVideo.addEventListener('ended', handledEnded etc does not seem to work

I couldnt find anything in createjs reference pertaining to video events.  Could anyone advise?

Thank you!

This topic has been closed for replies.
Correct answer ClayUUID

That is indeed the correct way to check for a media file ending. How are you setting the value of "myVideo"? You should be doing something like this:

var myVideo = document.getElementById("thisismyvideofile");

If you're using the HTML components, Animate sets the ID of the video element to the same as the instance name.

You should also set an "error" listener pointing to the same handler as "ended", so people don't get stuck if video playback fails.

1 reply

Jon Fritz
Community Expert
Community Expert
November 29, 2016

Moved out of the Forum Lounge (not for technical support) and over to the Adobe Animate CC - General forum.

ClayUUIDCorrect answer
Legend
November 29, 2016

That is indeed the correct way to check for a media file ending. How are you setting the value of "myVideo"? You should be doing something like this:

var myVideo = document.getElementById("thisismyvideofile");

If you're using the HTML components, Animate sets the ID of the video element to the same as the instance name.

You should also set an "error" listener pointing to the same handler as "ended", so people don't get stuck if video playback fails.

anton9800Author
Inspiring
November 29, 2016

ok, I was doing exactly that, but I goofed up and was setting up event listener on the div id, no the video id.  Thank you for help!