How to Get a Wistia Video Thumbnail Without the API


How to Get a Wistia Video Thumbnail Without the API

Wistia video provides some handy embed codes for your videos but what if you want to create a custom player or use the thumbnail image by itself. You can use their API but the setup could me more complicated than you need. Thankfully Wistia provides Oauth url’s used in WordPress to grab the data for each video as JSON. You can use jQuery to tap into this data and output however you need. Below is a code example of it working.

Codepen Demo

Table of Contents

HTML

<img data-src="e4a27b971d" alt="video" id="wistia-thumbnail">

<div id="wistia-embed"></div>

JS

$(document).ready(function () {
   //https://wistia.com/support/developers/oembed
   const wistiaID = $("#wistia-thumbnail").data("src");
   const wistiaWidth = 640;
   // iframe, async, async_popover, playlist_iframe, playlist_api, playlist_popver, and open_graph_tag
   const wistiaType = "async_popover";
   const popoverWidth = 640;
   const popoverHeight = 350;
   $.get(
      "https://fast.wistia.net/oembed?url=http://home.wistia.com/medias/" +
         wistiaID + "?embedType="+wistiaType+"&videoWidth=900&popoverWidth="+popoverWidth+"&popoverHeight="+popoverHeight,
      function (data) {
         console.log(data); // HTML content of the jQuery.ajax page

         thumbnail_url =
            data.thumbnail_url + "&" + "image_resize=" + wistiaWidth;
         $("#wistia-thumbnail").attr("src", thumbnail_url);
         $("#wistia-embed").html(data.html);
      }
   );
});

 

 


About the Author

Jacob Lett is the founder of Bootstrap Creative, a digital marketing consultancy that helps Michigan manufacturers generate qualified leads through HubSpot, technical SEO, and Google Ads. With over a decade of hands-on experience, he acts as a direct partner for B2B companies seeking measurable ROI from their marketing investment.



Related posts

Tags:

| Read My Editorial Policy

Want to Get Email Updates of New Articles?

Join My Email Newsletter