Asset URLs
Working with direct file URLs for Wistia-hosted content
Sometimes a particular implementation calls for the use of a file URL, what we call a Direct Asset URL in Wistia. This is the raw video or image file ending in the relevant file extension like .mp4
or .png
. Below are some techniques for obtaining these asset URLs with a few tips & tricks for using them.
An ’asset' refers to the any of the video or image files attached to media. Video files for streaming, thumbnail images, and storyboard images are all considered ’assets'.
Getting an Asset URL
Asset URLs are obtained through the Wistia Data API, specifically the medias:show method.
The response to a medias:show
request includes an array of assets
, with their direct URLs and information on each asset’s size and type. The OriginalFile
asset is the source media that was uploaded to Wistia, and all other assets are the streaming-optimized files delivered by the Wistia player during playback.
Alternatively, you can use this handy ’videolinkfor' tool. This makes it a little easier to get an asset URL without directly using our API, and it will give you a link for the 1280 x 720p asset URL, in .mp4
format.
Asset URL File Extensions
Asset URLs in Wistia take this form:
http://embed.wistia.com/deliveries/856970d9a4bcb9aab381a0bd9ab714f19d72c62f.bin
The .bin
extension at the URL is for binary. Certain clients won’t accept URLs with an unfamiliar extension like this one. In this case, you can drop the .bin
, add a slash, and append whatever filename and extension you like -– you’ll still get the underlying video asset.
So, say the URL above is an mp4 file and we need the URL to end in the proper file extension. Here’s how we would change it:
http://embed.wistia.com/deliveries/856970d9a4bcb9aab381a0bd9ab714f19d72c62f/my-file.mp4
Getting HLS assets
Wistia uses HLS playback by default - if you would like to retrieve HLS assets for your videos in m3u8 format, you’ll first want to grab an mp4 asset URL from your video using the Data API technique mentioned above. All m3u8 files in Wistia are generated dynamically from the mp4 files for that same media.
With an mp4 asset URL for your media, you can change the extension from .bin
to .m3u8
, which will return an HLS manifest file for that particular mp4.
Enabling Downloads from Asset URLs
If you are looking to allow downloads from asset URLs in your site or application, you can add the disposition=attachment
parameter to the end of the URL, e.g.
https://embed-ssl.wistia.com/deliveries/061aacab996e0da67c3dd65883025aa3efa6043d.bin?disposition=attachment
This will automatically download the file instead of trying to play it natively in the browser.
HTTP vs HTTPS Asset URLs
If you have an asset that’s served over HTTP and you’d like to get it served over HTTPS instead, you’ll need to change the subdomain from embed
to embed-ssl
. We use different subdomains for SSL and non-SSL assets because they’re sometimes served through different CDNs for performance reasons.
Thumbnails & Image Assets
Using the Data API or oEmbed endpoint, you can obtain the thumbnail URL for your video, and then manipulate it. You can request images from a specific time in your video, resize them, even crop them!
For more details, We have a dedicated guide all about working with images!