Skip to content

Using CDN for Videos Only

Daniel Neto edited this page May 26, 2020 · 9 revisions

Update - Deprecated tutorial

This Tutorial is deprecated, as long as we now transfer files using chunks, feel free to configure any CDN in your whole website

Why use a CDN?

To minimize the distance between the visitors and your website’s server, a CDN stores a cached version of its content in multiple geographical locations, the benefits of the use of a CDN are:

  • Faster load times for web and mobile users
  • Quickly scalable during times of heavy traffic
  • Minimizes risk of traffic spikes at point of origin, ensuring site stability
  • Decreases infrastructure costs due to traffic offloading (less load on origin)
  • Better site performance

UPDATE on 2020-03-19

On streamer version 8.6 and encoder 3.1 you probably can use any CDN in the whole URL. the upload limit is not an issue anymore as long as the videos are transferred in chunks

For older versions

This tutorial will describe how we set up the CDN (Cloudflare https://www.cloudflare.com/) to our videos.

Why can't we use CDN direct into my AVideo Platform site?

The short answer is: Because we will not be able to upload videos.

We choose to use Cloudflare as our CDN, but enable Cloudflare on AVideo Platform sites, makes the site useless as long as Cloudflare limit the max upload file limit to 100 MB and is not hard to have videos larger than that.

Depending on the plan your domain is subscribed to, Cloudflare limits data uploads to the following sizes:

  • 100MB Free
  • 100MB Pro
  • 200MB Business
  • 500MB Enterprise

The upload limits apply only if you have Cloudflare enabled (Orange cloud next to the DNS records on the DNS settings page). For example, if your domain is subscribed to the Pro plan, a visitor to your website can upload data up to 100MB, per request. This limit overrides any upload limit you may have set over a 100MB at your origin.

This is also described here https://github.com/WWBN/AVideo/wiki/About-Video-Upload

Our Solution

Create a separate domain or subdomain for your videos

This new domain will not be used to upload videos, only to host our static content, like videos and images

For example for the demo site, I create a domain called https://demo.avideo.com/, it is basically a copy of the demo site, also the same host. but if you try to upload a video to that site, it will not work, due to the upload limit.

So we can enable Cloudflare on this domain, and tell AVideo Platform to use this domain to our static content. to do this you must go to the CustomizeAdvanced plugin and put your CDN site (https://demo.avideo.com./) on the videosCDN field.

In essence, CDN puts your content in many places at once, providing superior coverage to your users. For example, when someone in London accesses your US-hosted website, it is done through a local UK PoP. This is much quicker than having the visitor’s requests, and your responses, travel the full width of the Atlantic and back.

Clone this wiki locally