If the problem exists in all browsers, then you may need to do some debugging of the mp4 videos to see if they are out of sync with audio and video feeds. For example, if the audio ends early and reports that to the player, then the "ended" event will fire. If the video feed ends early (before the audio has finished playing) then the event will also be fired. Regardless, the PowerPac video player is receiving the event from the html object element and is simply responding as it is designed.
Out of sync videos may only show themselves when played in web browser because of the codecs used by the browser and/or the canvas they are played on. This can also happen if the audio data rate is too high/low or the video frame rate is higher than the hardware can keep up with. In this latter case, the HTML 5 video player will drop frames which could cause and early end. The fact that the end occurs at different times may suggest that this is part of the problem.
How to test this theory: (try one or more of these debugging techniques)
- Set a time marker that corresponds to a point a few milliseconds before the end of the video. Does the end event fire BEFORE the marker is reached? If so, then the audio/video feeds are out of sync and the video is not reporting its position correctly.
- Set a time marker somewhere in the middle of the video, when the marker fires, then use htmlVideoControl() to move the video to the last frame and pause it. You will have to call the function twice to do this. Once to move the playhead and a second time to pause the video. This technique may be a little stubborn unless the video stream has been fully cached first.
- Try allowFlashFallback = true so the Flash can play the video. If the video ends properly, then it is very likely the video is having trouble with the decoder used when it is played as pure HTML 5.
- Try and re-encode the video using a different frame rate or audio data rate. Does this affect the playback and how the end event is fired?
If it seems the audio/video streams are out of sync:
- Try adding a few empty frames to the end of the video and re-encode. This may at least make the situation workable.
- Try using a different encoding package to re-encode the video.
- Convert the video to avi or ogv format, then back to mp4. This sometimes cleans things up too.
- Try changing the encoding to h263 for these videos.
NOTE: Not all video streams are created equal. Some videos play more smoothly than others and report their position better. I've seen short videos (less than 30 seconds) report their positions to the browser in jerky increments. In these cases, it helps to increase the frame rate. Frame rates less than 15 may just not work very well.