Skip to main content
dianam81535829
Participating Frequently
January 18, 2018
Answered

Detecting end of mp4 in video component

  • January 18, 2018
  • 2 replies
  • 3596 views

I have an HTML Canvas file setup that plays a simply animation at the beginning then a keyframe is set to stop the timeline and I have an .mp4 play in a video component object. This works well until I add code to detect when the movie has reached its end so I can move ahead to the next frame in the timeline.

How is that done? I've tried a few things I've found on the web but they are all from around 2011.

The follow just gives me a blank white screen:

_this.stream.addEventListener(NetStatusEvent.NET_STATUS, statusChanged);

function statusChanged(stats:NetStatusEvent) {

    if (stats.info.code == 'NetStream.Play.Stop') {

         _this.gotoAndStop(85);

    }

}

This topic has been closed for replies.
Correct answer kglad

It an HTML5/Canvas. And just to clarify what I'm doing, here's a screenshot.


your code is completely wrong, then.  you're using the wrong scripting language.

you must remove every line of code.  then you must use javascript and can use createjs, CreateJS | A suite of JavaScript libraries and tools designed for working with HTML5

you can try the code in message 9 using a local path to your mp4 or don't even assign the src propertly if you're using the component parameters panel to assign the source.

2 replies

rickg1949
Known Participant
January 29, 2018

Couldn't quite follow explanation for creating code snippet for creating an event when MP4 video ends.

I simply want to return to a menu frame on timeline when each of several movies ends.  Each has a separate instance.

Appreciate the hint.

rg

Robert Mc Dowell
Legend
January 29, 2018

use event "NetStream.play.stop" from Netstream NetStatus event

kglad
Community Expert
Community Expert
January 29, 2018

this is an html5 thread.

kglad
Community Expert
Community Expert
January 18, 2018

what's _this?

dianam81535829
Participating Frequently
January 18, 2018

I think "_this" denotes the current scene you're on, but even if I remove it I still just get a blank page.

dianam81535829
Participating Frequently
January 19, 2018

it would be easier to solve your problem if you provide the full code


That is all I've attempted. There is no other code. I simply have an mp4 embedded using the video component and have an idea what I need to include as far as code to detect when the mp4 has finished playing.