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

"No suitable players found" - Event Trigger Request


I wanted to use an image fall-back in case HTML5 video and Flash were not supported in a user's browser. I did not like how the image would appear before the video had loaded (as my videos were auto-playing) when I used the 'image' declaration in the setup:

bc.. jwplayer().setup({image: '...'});




I ended up altering the jwplayer.js source to trigger a custom event when the "No suitable players found" message is logged in the console:

bc.. a.utils.console.log("No suitable players found");




My request is to add this feature to a future release as it seems quite useful if the only time you want to display an image is if there are no other ways to display your media.

Note: I am using jQuery so my event trigger also uses jQuery code but here is the change I made to the jwplayer.js source:

bc.. a.utils.log("No suitable players found");
$(document).trigger('videofail');



Thanks for the easy-to-use player,
-Jasper Howard

6 Community Answers

Pablo

JW Player Support Agent  
0 rated :

@Jasper -

We have a ticket here that should address your suggestion:

http://developer.longtailvideo.com/trac/ticket/1450

JW Player

User  
0 rated :

Please add my vote to that one. onError would be appropriate IMO.

JW Player

User  
0 rated :

Another way that would be great is if getState() and/or getRenderer() returned something from the start:

var jw = jwplayer(id).setup();
jw.getState() // returns undefined
jw.getRenderer() // returns undefined

Doesn't seem like you can do anything with the object returned by setup except for add listeners that won't get called if a suitable player is not found.

Pablo

JW Player Support Agent  
0 rated :

@Rob -

I’ve added your upvote to the ticket.

As for those getters, you shouldn’t request any player state variables (i.e. any of the getters) until after the onReady event has fired. There is no player state immediately after setup() because there is no player yet.

JW Player

User  
0 rated :

Plus one on the request. The player should throw an onError and / or a new noSuitablePlayer event.

JW Player

User  
0 rated :

+1 the request to have an official way to handle the error.

Our player shows a still from a webcam and then initiates the player over the top of the still with the players image the same as the still. JW player takes a little while to load so this makes the player initiation seamless to the user, the play button just appears so I need to handle the no player message in js.

Until it's officially supported, I've done something like below.

bc.. jwplayer.utils.log = function(msg, obj) {
if (typeof console != "undefined" && typeof console.log != "undefined") {
if (obj) {
console.log(msg, obj);
} else {
console.log(msg);
}
}

if (msg == "No suitable players found") {
// Do some custom stuff here.
}
}


This is a silly and quick work around, but does the job at the moment. Issue is scheduled for 6.0 so could be a while!

This question has received the maximum number of answers.