What is the Optimize For Video feature?
The "Optimize for video delivery" feature allows you to efficiently request, cache, and deliver video files. If enabled, it splits requests to large files into many smaller chunks and caches each of them separately. This also allows bunny.net servers to send Range requests for uncached files which are required by web browsers to efficiently fetch, play, and skip through large video files.
bunny.net will then only request and cache the requests from the origin that are actually required by the request and will not download the whole file unless needed.
To the end-user, this works completely transparently and the system automatically combines all the cached and or uncached chunks.
Because the Optimize For Video feature splits and requests data into smaller chunks, it can reduce the overall throughput when delivering large uncached files. This is because the CDN servers need to make a new HTTP request for each chunk that it needs to build a response.
🚧 Caching Warning
Because the Optimize For Video feature treats each piece of cached data as a separate object, it is important to know this during cache management.
When enabled or disabled, this will change the caching keys and any existing cached content will be discarded and the cache will need to be repopulated. This will not clear the cache, so if you switch the setting back, it will continue to use previously cached content.
If a large file changes, it is important to always purge the cache data for that URL. If not, it can happen that a file might become corrupt and unusable due to multiple different chunks being put together.
If Optimize For Video is enabled, we recommend using unique file-names for files to avoid this potential issue.