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.
Note
The Wistia APIs were specifically built for videos in projects. We do not formally support using our APIs for audio files in projects, or audio or video episodes in Channels at this time. For the most reliable experience, we recommend continuing to use these for videos in projects.
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'.
Alert
We generally do not recommend using Asset URLs, as accessing a Wistia-hosted video file outside of the video player means you won't get any video stats, analytics, customizations, HLS playback delivery, or other features specific to the Wistia player. This activity does count towards your account's bandwidth usage however. If you do start using Asset URLs, be aware that bandwidth usage may increase significantly, which can incur additional usage costs for your account.
Getting an Asset URL
Asset URLs are obtained through the Wistia Data API, specifically the medias:show method. This request requires an API token which can be obtained by or from the Account Owner.
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.
Note
The
OriginalFile
is used as a blueprint for encoding a set of streaming assets, and is never used for video streaming/playback in the Wistia player. Originals are typically much larger in size compared to our streaming-optimized assets, which means higher bandwidth usage when viewed or downloaded. Unless you're looking for a backup of your original, we generally recommend against using theOriginalFile
for embedding or downloading, as doing so can lead to high usage costs.
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:
https://embed-ssl.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:
https://embed-ssl.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.
Note
The contents of the .m3u8 playlist does not include captions data. If you use the "main" .m3u8 playlist, the information will include captions data.
That format of that main playlist is as follows:
https://fast.wistia.com/embed/medias/HashedID.m3u8
Enabling Downloads from Asset URLs
Alert
Reminder that asset URL viewing and downloads will contribute to bandwidth usage in your account. Enabling downloads from direct assets creates the risk of a spike in bandwidth, and thereby increased bandwidth costs, but without any video stats to represent it.
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!
Updated about 1 month ago