freakk69
freakk69

Reputation: 161

callback for player.sendEvent() in jwplayer

Is there any way to add callback function for player.sendEvent() in jwplayer.

function timeseek(obj){
        seek_position = obj.position ;
        player.sendEvent('PLAY',false);//pause video
        updateT(logid,seek_position,1);//update db with current paused value
        player.sendEvent('SEEK ',seek_position);//seek to position
        player.sendEvent('PLAY',true);//Play video
            }

i want to do actions in above function one after the other.

Upvotes: 0

Views: 1855

Answers (1)

krg
krg

Reputation: 2790

I am not a JWPlayer expert, however, if I understand the question correctly, and my assumption is correct on what sendEvent is doing, then I would try the following:

player.onPlay(function(e) {
  // do something...
});

player.onSeek(function(e) {
   // do something
});

Because JWPlayer is event driven, you can listen for events and state changes, when something happens that you care about, you react in your event handler. If you explain exactly what you want to do after specific events, I can provide a more concrete example.

See JWPlayer Events Documentation for more information.

Upvotes: 1

Related Questions