javascriptreactjsvideobrightcove

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:


Solution

  • Here is how I got this working;

    ā€ƒ- 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