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);
      }
   );
});

 

 



Written by: Jake Lett
Jake Lett is a B2B marketing consultant with over 15 years of experience in the digital marketing industry. He specializes in SEO, HubSpot, and PPC campaign management. Jake has a proven track record of helping businesses increase their online visibility and drive more traffic, leads and sales. He is a Certified Google Ads Specialist and a Certified HubSpot Developer.

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter