player.js: Ended event is not fired for our video

Hello there!

Thank you for this new API, it looks much better than Froogaloop.

However, we have some issues with ended / finished event. It’s not called for our video. But, if we use some other public video from Vimeo it works OK. Maybe there is some issue with privacy or embed settings? It was working some time ago and was broken recently. We are experiencing this problem for both API versions of Vimeo.

For now I have to use:

timeupdate: function (event) {
  if (event.percent >= 0.95) {
    // Video finished...
  }
}

Also, the last called timeupdate event has percentage around 0.99, it’s never called with 1.0, maybe it’s somehow related to ended problem.

Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 43 (9 by maintainers)

Most upvoted comments

Same issue here. And it’s been YEARS. We also pay for a premium Vimeo account, and I’m mind blown that you guys can’t solve something like this with this much time. “seeked” and “timeupdate” not firing or firing RANDOMLY at times… I can’t deliver a product where the UI depends on timeupdates and seeked events with it only working SOME of the time.

Will this even be addressed?

Ok, I should have looked first, but found this issue that solves this problem by removing the api=1 from the API call. Maybe this is something I had from the previous Froogaloop implementation.

@wcndave of course, because timeupdate event is called multiple times per second while video is playing. It was simplified example. If you want to call your finish method only once, then you need to introduce some flag variable in order to prevent multiple executions.

Example

timeupdate: function (event) {
  if (!finishCalled && event.percent >= 0.95) {
    finish();
    finishCalled = true;
  }
}

@mikegarlick this is my solution:

var finish = _.once(yourOnFinishFunction);

player.on('timeupdate', function(data) {
  if (data.percent === 1) {
    finish();
  }
});

@luwes player ended isn’t firing for this video https://vimeo.com/92182340

Ah I see, thanks for the feedback. Not sure if we’ll be able to add that debug feature but I’ll bring it up.

@ahmadawais Could you post some clips where this is the case? Thanks

I still having issue with ended, seeked I am adding the player as described here https://developer.vimeo.com/apis/oembed#arguments, using oembed endpoint and HTML returned by endpoint.

When I doesn’t add the &api=true to the oembed endpoint - I doesn’t have ?api=1 in iframe url. and ended, seeked as well as seek , finish doesn’t triggered. But If I add &api=true to the oembed endpoint, ?api=1 appears in iframe url, and seek fired. Also, seek fired at the end of the video with no user interaction, with data.seconds == 0.

PS. the way how I am construction player:

  1. in the parent window AJAX call no the page send request to server.
  2. Server call oembed endpoint
  3. Server returns JSON, with oembed iframe HTML
  4. in the parent window On AJAX success, client trigger JS code to open jQuery UI dialog with oembed iframe HTML returned from server.
  5. in the parent window client load https://player.vimeo.com/api/player.js
  6. in the parent script get the reference to the player with the following code:
window new Vimeo.Player($('#drupal-modal iframe'));

Hi, everyone. We recently made an update to the player that should resolve this issue for good. I’m going to close this issue, but please comment with a link to the video if you’re still seeing this happen and we’ll take a look.

Will wait for it then, thanks. The workaround is working pretty good, so no worries.