Video Streaming from Google Cloud Storage

2020-06-18 03:52发布

问题:

How would we go about getting a video from google cloud storage and streaming that video to a mobile device?

I dont see anything related to videos in the Java API like there is for getting images with ImagesServiceFactory

The videos are only going to be a maximum of 10-15 seconds long if that makes any difference.

Any advice on how to proceed here would be great

回答1:

There is no difference between streaming a video and downloading any other file from the Cloud Storage. Thus, no special video API.

If the files are not public, you need a servlet that will read the content of the video from Cloud Storage and stream it to the client. Note that you cannot run it on App Engine or managed VM as they do not support file streaming and the request size is limited to 32MB.

Your best option is to run this on a Compute Engine instance:

  1. Bandwidth between Compute Engine and Cloud Storage is free.
  2. Authentication is simple.

Alternatively, you may use a signed URL for your video files. This saves you from developing/deploying a separate Compute Engine instance just for the streaming purposes - signed URLs can be returned by your existing backend.