Skip to content
Advertisement

Brightcove video player events for React

Need: I want to get the onComplete event (like the answer here: How to detect the end of a BrightCove Video?) but not able to hook it up to the react version – the documentation link in the answer also returns a 404

MVCE:

Advertisement

Answer

Here is how I got this working;

  • there is no onComplete (or even onEnded or onFinsihed) event anymore like this answer on stackoverflow suggested
  • we have to work within onSuccess function
  • these links helped:

 - https://player.support.brightcove.com/publish/brightcove-player-loader.html#Available_parameters

 - complete list of events: https://docs.brightcove.com/brightcove-player/1.x/Player.html

relevant JS:

onSuccess: function(success) {
      var myPlayer = success.ref;
      myPlayer.on('ended',function(){
         console.log('video ended...');
      });
    },

complete working codepen here

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement