HTML5 Canvas action at the end of a video

Community Beginner ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

Hello everybody,

 

I'm using Animate HTML5 Canvas project with a component Video into a frame on the timeline (full screen).

Now I need to do a "GotoAndStop" at a certain frame once the video is ended.

How can I do that ?

Best regards

Views

40

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Mar 02, 2022 Mar 02, 2022
Hi. This should work (the loop property of the Video component must be set to false) : var root = this; var videoID = "yourVideoID"; // the id is set in the Properties panel when the video component is selected var video; function drawEndHandler() { video = document.getElementById(videoID); video.addEventListener("ended", endedHandler); } function endedHandler() { video.removeEventListener("ended", endedHandler); root.gotoAndStop(1); } root.stop(); stage.on("drawend", drawEndHandler...

Likes

Translate

Translate
Adobe Community Professional ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

Hi.

 

This should work (the loop property of the Video component must be set to false) :

 

 

var root = this;
var videoID = "yourVideoID"; // the id is set in the Properties panel when the video component is selected
var video;

function drawEndHandler()
{
	video = document.getElementById(videoID);
	video.addEventListener("ended", endedHandler);
}

function endedHandler()
{
	video.removeEventListener("ended", endedHandler);
	root.gotoAndStop(1);
}

root.stop();
stage.on("drawend", drawEndHandler, null, true);

 

 

 

I hope it helps.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

LATEST

Just perfect, working so fine.

It's magical 🙂

Thank you, all best

Philippe

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines