Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

JW7 Events via jwplayer setup

I'm currently working through migration from JW6 to JW7. I've gone through the documentation, and reviewed the new JW7 API Event Handling. I realize all "onEvents" have been deprecated in favor of on('event'), but for the time being (JW Player v7.2.3 Premium), they still work. I presume JW8 they will be removed.

The problem I'm currently facing is that most events working on JW6 defined in setup() events still seem to be firing, but not all (e.g. onFullscreen does not):

... ,
events: {
onReady: function(){ ... },
onBeforePlay: function(){ ... },
onFullscreen: function(){ /* Does not fire? */ }

I realize I should convert each player event to this format: playerInstance.on(event, [callback], [context]), but I can't find any JW7-specific documentation about supporting events configured via JW Player setup(), while yet it appears some of them are indeed supported.

Does anyone know where to find JW7 documentation outlining this support? Why would some events configured in this manner work, and onFullscreen does not? (Perhaps others?)

3 Community Answers


0 rated :

Aha! I have found the culprit.

It turns out, the event itself _was_ firing as expected, but the gap in our custom analytics suggesting a misfire was based on the following condition:

if( jwplayer().getState() == 'PLAYING' ){ ... }

Adjusting all player state checks to be lowercase (per JW7 API change) fixed the problem!

I still couldn't seem to find the documentation for setup({ events:{}, }) though...


JW Player Support Agent  
0 rated :

Hi, there.

I’m glad you got everything worked out. Please note that JW 7 no longer supports setting up events in the player’s configuration itself. All events should be utilized in separate functions outside of the player’s setup.

Please let me know if you need any more help or have any other questions.

Thank you!


0 rated :

Thanks, Alex. While the original approach still seems to work, we'll be sure to upgrade to the new format now.

This question has received the maximum number of answers.