2

I have a video streaming application which does streaming the video from google storage bucket. All the files which reside on the storage bucket are not public. Every time when users click on a video from the front-end I am generating a signed URL using API and load into the HTML5 video player.

Problem

  • I see if the file size is more than 100 MB it takes around 30-40 sec to load the video on front-end.

When I googled to resolved this problem, some of the articles are saying use cloud CDN and storage bucket then cache the file. As far as I know, to cache the file, the file has to publicly available. I can't make files publicly available.

So my concern is, are there any ways where we can make it scalable/ reduce the initial time?

  • 1
    This looks valuable to your story ... https://cloud.google.com/cdn/docs/private-content#signed_cookies – Kolban Aug 21 '20 at 18:53

2 Answers2

2

Cloud CDN will help your latency for sure. Also, with that amount of latency it might be good to look into the actual requests that are being sent to Cloud Storage to make sure chunks are being requested and that the whole video file isn't being loaded before starting to play.

Caching the file does not require that the file is public. You can make the file private and add the Cloud CDN service into your Cloud Storage ACLs (https://cloud.google.com/cdn/docs/using-signed-urls#configuring_permissions). Also, as Kolban noted above, signed cookies might be better for your application to streamline the requests.

Paul Caponetti
  • 295
  • 1
  • 2
  • 9
  • Hi @Paul - Thanks for your reply. Could you please guide me on how to generate a programmatically signed URL using node js. I have configured CDN for backed bucket and created a service account, but got stuck in generate a custom signed URL. – justAnAnotherCoder Sep 16 '20 at 06:46
  • There's a module to do this linked from this other answer: https://stackoverflow.com/questions/20754279/creating-signed-urls-for-google-cloud-storage-using-nodejs . Is there an issue you are having that isn't handled with the library? – Paul Caponetti Sep 20 '20 at 23:47
0

Not an exact answer but this site is useful to design solution using GCP. https://gcp.solutions/diagram/media-transcoding

As mentioned earlier, CDN is right way to go for video streaming with low latency. enter image description here

Netro
  • 7,119
  • 6
  • 40
  • 58