As a publisher, you will most probably meet people that will attempt to access content without having paid for it, or try to download the content. Signed URLs are one of the effective approaches to securing your content and countering such actions.
These tokens are digitally signed, ensuring that the attributes of the token will not be tampered with. The tokens are valid only for a certain time and they are tied to the user ID. Therefore, requests beyond the expiration time will return an HTTP error code. So will request with an altered or missing token.
In FV Player, this is handled by the Stream Loader feature. In order to use Stream Loader, you have to have the FV Player Pro version. It works with any CDN supported by FV Player Pro (CloudFront, Bunny CDN, KeyCDN, Cloudflare, StackPath) and AWS S3 or DigitalOcean Spaces.
The basic building block of HLS stream is the m3u8 file. However, these files are static, thus they cannot use video segment URLs with time-sensitive tokens. Stream Loader inserts proper URL tokens on the fly, which allows it to get past these limitations.
Note:If you are also encrypting your videos, this is an additional layer of protection.
How to enable Stream Loader
First, you need to enable the feature in the settings of FV Player Pro.
Go to Settings -> FV Player Pro -> Setup tab -> Stream Loader and click Enable.
If you have a large amount of viewers and the performance of your website could be negatively affected by this feature, you can also select the Speed-up option, which activates faster serving by bypassing WordPress.
Secondly, you also need to enable URL tokens on your CDN.
Enabling URL tokens on FV Player Coconut
If you are using our free Coconut add-on to encode and encrypt your videos, you can skip the CDN setup and just enable the Stream Loader feature in FV Player Pro settings, as FV Player Coconut does this automatically.
Note: Encryption and URL Tokens in FV Player Coconut are only available for FV Player Pro users.
Enabling URL Tokens on CloudFront
Since many of our users distribute their videos via CloudFront, we have prepared the steps for this CDN:
1.You will need to restrict viewer access. In order to be able to do that, you first need to obtain and insert your Private Key. On how to do that, please follow this guide.
2.Go to CloudFront Distributions page in your AWS console.
3.Check the box of your distribution.
4.Go to the Behaviours tab, select the default behaviour, and click Edit.
- Look for Restrict Viewer Access (Use Signed URLs or Signed Cookies) option and pick Yes. Enabling this opens up two new options. In Trusted Key Groups or Trusted Signer pick Trusted Signer. In the next option, pick Self as the Trusted Signer.
Save by clicking Yes,Edit in the bottom right corner of the page.
Go back to the General tab of your CloudFront distribution and copy the domain name.
- Now go to Settings -> FV Player Pro -> Hosting tab -> CloudFront (Pro) and enter the domain name of your distribution into the CloudFront domain field.
Note: If you already have other domains in this field, just separate them with a comma.
Try it out yourself. Try obtaining the HLS URL from the source code of this page or try to download the video.