finish event fired more than once #242
Comments
This is a major issue, since videos are stopping before they finish. Even more so if playlists are involved. |
Workaround in global api setup: flowplayer(function (api) {
var finished = false;
api.bind("resume", function () {
finished = false;
}).bind("finish", function (e, api) {
if (!finished) {
console.log("finished");
finished = true;
}
});
}); |
For html5 the cause is clear. In lib/engine/html5.js we are mapping the event "ended" from video tag to flowplayer event "finish". However, we are also firing the "finish" event from "progress" event if currentTime reaches duration. However, the fix isn't obvious. The "progress" event hack must be there for a reason, so I dont' dare to remove it. Are there cases where player.video.duration wouldn't be set but the video tag still would emit ended event? My initial fix would be to just remove the ended -> finish mapping as we are handling this special case already but I really wouldn't want to break anything with this fix.. |
@blacktrash if a video tag is looping, should the finish event fire? It seems that atleast in some browsers when video tag loops it doesn't fire the "ended" event (which in flowplayer would get translated to finish event) So in my tests I could remove the check for current time vs. duration and remove the additional finish event firing IF we don't need finish event firing for looping videos. |
Short answer: No finish event for a looping clip. Simply because that's the truth: the clip does not finish, it loops. Longer answer/thoughts: Question: Now for the problem: Already: This is how I have implemented it for the FP Flash JS playlist plugin:https://github.com/flowplayer/flash/blob/master/js-plugins/playlist/flowplayer.playlist.js#L162 ff. - Note that for the FP Flash playlist plugin the default behaviour corresponds to |
@nnarhinen - I've implemented "manual" looping using the "first" finish event here: http://demos.flowplayer.org/playlist/scrollable-jquerytools.html - but @bbbo told me that it breaks in IE9, so IE9 needs thorough testing in this context. |
yes, plays first clip only in IE9 (with both letting the playlist go |
@blacktrash @bbbo http://demos.339f.flowplayer.me/ shouldn't double-fire finish event. Please test. |
@nnarhinen - uggh http://demos.339f.flowplayer.me/bug/274.html stops working |
Remove additional finish event triggering fixes #242
I am using Flowplayer 7.2, using API to get events like pause, next, finish. Thanks, |
Please ask usage related questions in the forums. Having the pause event triggered before finish is expected - technically the player pauses when it reaches the end of the video. You need to check |
flowplayer api resume event called more than once each time when reinitializing the flow player after stopping it. |
Flowplayer 7 is deprecated, there won't be any further fixes. |
Easy to detect:
See: http://flowplayer.org/forum/#!/moot/7204
Can be worked around with a more global var, but still unexpected.
The text was updated successfully, but these errors were encountered: