Support » Plugin: WP YouTube Lyte » #hqThumb=1 not reflecting on playlists in custom fields

  • Resolved Kevinlikes

    (@kevinlikes)


    Hi Frank
    Thanks again for the great plugin.

    We managed to get the httpv: playlists working fine in custom fields, but they’re now not displaying #hqThumb=1. See http://bit.ly/1sib3SH as an example from a 1080p video.

    Is #hqThumb=1 set up to work with playlists, or just with individual videos? And do you have any suggestions on getting this to display a better quality thumbnail – the fuzziness is going to be a deal-breaker with the client, who’s considering Vimeo as an alternative…

    https://wordpress.org/plugins/wp-youtube-lyte/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Frank Goossens

    (@futtta)

    For playlists the thumbnail-URL is gotten from YouTube-API (as there is not easy way to “guess” the thumbnail) which has no reference to the high-resolution thumbnail (example here).

    What you could do to work around that, is to hook into the lyte_content_postparse-filter to bluntly str_replace hqdefault.jpg with maxresdefault.jpg? This should work, on the condition maxresdefault.jpg is available (which appears to be the case if the video was uploaded in HQ).

    hope this helps,
    frank

    Kevinlikes

    (@kevinlikes)

    Thanks Frank. Have my developer looking into it and will let you know.

    Notice there have been a couple of requests on the forum for more image quality control.

    My media library is full of auto-generated video thumbnails. Would there be a way to use these as the thumbnails for YouTube Lyte, so that I could then use a plugin like Replace Media to be able to load the image I want at the exact dimensions I want, rather than at 1280 on maxresdefault? It’s more legwork for me, but I would be happy to do it for the added control. I actually tried replacing a couple of the video thumbnails and clearing the YouTube Lyte cache, but the changes didn’t seem to reflect, so I assume YouTube Lyte isn’t running off the media library?

    Plugin Author Frank Goossens

    (@futtta)

    first of all; better hook into “lyte_match_postparse_template” to switch to maxresdefault.jpg instead of “lyte_content_postparse”.

    Now that that’s out of the way; I could in a next version of Lyte add a filter to override the thumbnail (lyte_match_thumbnail_url), you could then code some logic to search for the video ID in the default thumbnail and replace the URL with one which you consider correct for that YT ID. Would that work for you?

    Simon Barnett

    (@simbasounds)

    Thanks Frank. Amazingly helpful, as ever : )

    Yes, a thumbnail URL filter would be a great option to have. Since we only ever have one video per page on this site, I could simply and crudely override the video image URL in CSS by entering a Custom Field, but a filter would be so much better.

    Plugin Author Frank Goossens

    (@futtta)

    OK, if you (have your developer) open up wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php, then on line 313, after the “forcecaptionsupdate”-conditional block, add this;

    /** API: filter hook to override thumbnail URL */
    $thumbUrl = apply_filters( 'lyte_match_thumburl', $thumbUrl);

    With that in place, you can change the thumbnail-URL with e.g.:

    add_filter('lyte_match_thumburl','lyte_my_own_thumburl');
    function lyte_my_own_thumburl($thumb) {
            return "http://images.vrt.be/mobile320/2014/08/05/8570f3aa-1c9e-11e4-b923-00163edf75b7.jpg";
            }

    Inside that function you can apply whatever logic you want to decide on which thumbnail-URL to push.

    This (or something very similar) will go into the next WP YouTube Lyte release.

    hope this helps,
    frank

    Simon Barnett

    (@simbasounds)

    Thanks Frank,
    I’d prefer not to change core files, and my crude solution – only good for one video per page – is working fine for now. I simply used:

    $video_image = get_post_meta(get_the_id(), 'VideoImage', true);
    if (!empty($video_image)) {
    	echo "<style type=\"text/css\">.lyte .pL {background-image: url(". $video_image .") !important;</style>";
    }

    hooked in wp_head and wrapped in a function.

    I’ll wait for your official update before making the code more elegant.
    Thanks for continuing to improve this great plugin : )

    Plugin Author Frank Goossens

    (@futtta)

    OK, I’ll ping you here when the new version goes up (working on Autoptimize 1.9 now, so this will probably somewhere in Sept.)

    Kevinlikes

    (@kevinlikes)

    Thanks Frank. Site’s already looking better & loading faster…

    Plugin Author Frank Goossens

    (@futtta)

    FYI; Just pushed 1.5.0 out which has the thumbnail filter.

    Thanks Frank. You’re a legend. Looking forward to testing this out. Happy new year…

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘#hqThumb=1 not reflecting on playlists in custom fields’ is closed to new replies.