How to Use In Jw player Different Preview Images for Mobile and Desktop

I’m using “jw player plugin” in wordpress and I want to use different preview images for desktop and mobile devices.

I’m trying to add it as JavaScript. But this code isn’t working:

Read More
jwplayer.utils.isMobile()?"http://internetzengini.com/wp-content/uploads/2015/02/mobileimage.png":"http://internetzengini.com/wp-content/uploads/2015/02/desktopimage.png";

How can I make this work as JS?

Thanks from now for all the helps.

Related posts

Leave a Reply

2 comments

  1. The best way to do this would be to do a different set up entirely for mobile vs desktop.

    if (navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPhone/i) != null || navigator.userAgent.match(/android/i) != null){
    //SET UP PLAYER WITH ONE PREVIEW IMAGE HERE
    } else {
    //SET UP PLAYER WITH A DIFFERENT PREVIEW IMAGE HERE
    }
    
  2. I’m adding the player via shortcode, and I was able to start/stop on video clicking by using this code as Java added to wordpress:

    jwplayer().onDisplayClick(function() { jwplayer().play(); });
    

    Is there any way to format the above code the same way, because it is easier for me to set it up as Java.