Why prismic is not serving MP4 videos via CDN?


I am developing a website that has multiple mp4 videos across different pages.

The video download time is slow and I have noticed that prismic is serving the mp4 files direct from S3 Buckets instead of a CDN like Cloudfront, it's also doesn't use any kind of compression to reduce the data transfer.

I read in the docs that prismic uses CDN by default, so I was wondering why prismic is serving the video files directly from S3 Bucket without compression?

Thank you very much!

Hey Tim, thanks for reaching out!

It is true that Prismic doesn’t currently offer an automatic compression with videos. We do it with images using the Image Optimization feature. So Maybe a solution would be to manually compress videos before uploading them to your Prismic media library.

And as you said, assets stored in the Prismic media library are stored in an Amazon S3 bucket and have a public URL. AWS provides Prismic connectivity to a variety of telecommunications and network service providers. AWS also provides Prismic with environmental control systems including fire suppression systems, cooling systems, uninterruptible power supply (UPS) systems, and generators.

You can read more details about this in our Security page.

Have you tried embedding youtube/vimeo/wistia videos instead?

Yes, as @marcellothearcanesuggested, hosting embedding video URLs that come from YouTube or Vimeo into an Embed field is a great approach. These services offer video compression support and both provide an excellent video player. We talk about that in this article:

Thanks for your reply!

Hey @tim2 even though we advise user to use embed for the reason that @Pau described, the mp4 that you upload should be distributed through CloudFront.

Are you not seeing a CDN endpoint when fetching a document through the API that links to an mp4 file?

I tried to reproduce but didn’t have the issue. Can you please send me an example of a request that I can replay to see the issue?

Thanks a lot,

1 Like

Closed due to inactivity

Hi Renaud,

unfortunately I'll have to bring this issue back up - on the website I'm working on I can see that the images are served via imgx and properly compressed. Unfortunately the videos seem to come from S3, no sign of Cloudfront nor compression - same thing happens to the other non-image assets. On this website there's a fairly heavy use of lottie files (json) and those come through uncompressed.
Is it something you guys are looking into implementing a some point or is it just a bug?

Thank you in advance for your time!

Hello @fabio1, could you please send us your repo name and the URL of these assets?

Hi Pau, sure thing - where should I send the info?

Hey there. You can send it here or in a private dm to me