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:
- Using the codepen on https://player.support.brightcove.com/coding-topics/react-player-loader.html
- unable to get
onCompleteto fire, like success case is firing (onSuccess: function(success))
Advertisement
Answer
Here is how I got this working;
- there is no
onComplete(or evenonEndedoronFinsihed) event anymore like this answer on stackoverflow suggested - we have to work within
onSuccessfunction - 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