AdamHurwitz
AdamHurwitz

Reputation: 10364

Stream mp3s From Firebase Storage

Issue

I am building a backend service that creates mp3s for an Android client to stream via ExoPlayer.

Looking at Firebase's Storage Pricing in the long term, if there are 10 gbs stored and 10,000 users there would be 100,000 gb to transfer which is very expensive ($11,600).

What would be the best solution to stream mp3s on the cloud in order to avoid data transfer fees?

Possible Solutions

  1. Use ExoPlayer to stream mp3s directly from the cloud without downloading.
  2. Use a separate API to download the 10gb from Cloud Storage one time, and stream the mp3s to the mobile client from the separate API.

Upvotes: 3

Views: 1606

Answers (1)

AdamHurwitz
AdamHurwitz

Reputation: 10364

Possible solution #1 is the best solution: Use ExoPlayer to stream mp3s directly from the cloud without downloading.

Thank you Oliver Woodman on the ExoPlayer team for resolving this question on Github!

If a mp3 file is saved to the cloud, ie:Firebase Storage / Google Cloud Storage, can the file be streamed from Exoplayer without needing to download the full file size?

Yes. That's just what happens by default when you use ExoPlayer to play a stream.

If the mp3 can be streamed directly from Cloud Storage roughly what percentage of memory of the file is used in the transfer of the stream since the file itself is not being downloaded?

You can configure this by instantiating your own DefaultLoadControl, which you can pass to ExoPlayerFactory.newSimpleInstance when building the player. You can also implement your own LoadControl from scratch if you need more control.

Note that whilst buffering less far ahead saves on data transfer costs, it also makes re-buffers more likely to occur because the player will be less able to ride out temporary network connectivity issues.

Upvotes: 3

Related Questions