Streaming Firebase Video

I am working on an application that has video streaming features. I am using firebase database and firebase storage. I am trying to find some documentation on how the firebase repository handles video files but cannot find much.

The docs mention that firebase storage works with other google application services to provide CDN and video streaming, but all searches seem to lead to a deadlock. Any advice?

+25
video-streaming firebase firebase-storage google-cloud-platform
Jun 16 '16 at 17:12
source share
2 answers

I think there are several types of video streaming that can change our answer here:

  • Live broadcast (subscribers watch how the event occurs)
  • Youtube style (posting videos and end users at their convenience)

Having created a Periscope-style streaming application using Firebase Storage and the Firebase Realtime database, I highly recommend against this - we downloaded three second fragments and synchronized them through the Realtime database. Despite the fact that it worked (surprisingly good), there was ~ 5 seconds of latency on a very good Internet resource, and it was also not the most effective solution (after all, you download and save this video, and also do not transcode) , I recommend using some WebRTC style created for video transport and using the Realtime database for signaling along the stream side.

On the other hand, you can definitely create mobile YT features for Firebase. The trick here is to transcode the video (using something like Zencoder or Bitmovin, here: https://cloud.google.com/solutions/media/ ) to cut the downloaded video into smaller pieces of different resolutions (and in different formats, for example, iOS requires HLS for streaming). You can store information about a piece in a real-time database (chunk name, available permissions, number of fragments) and download the mentioned fragments from the repository as the video progresses.

+14
Jun 16 '16 at 22:58
source share
— -

If you want to release videos from Firebase Storage, this is the best way to find. This will depend on the size of your video file. I only request 10-30mb files, so this solution works well for me. Just refer to Firebase Url as a regular URL:

String str = "fire_base_video_URL"; Uri uri = Uri.parse(str); videoViewLandscape.setVideoURI(uri); progressBarLandScape.setVisibility(View.VISIBLE); videoViewLandscape.requestFocus(); videoViewLandscape.start(); 

If you want to loop the video:

 videoViewLandscape.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setLooping(true); } }); 

And if you want to show the progress bar before starting the video, follow these steps:

 videoViewLandscape.setOnInfoListener(new MediaPlayer.OnInfoListener() { @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) { progressBarLandScape.setVisibility(View.GONE); return true; } else if(what == MediaPlayer.MEDIA_INFO_BUFFERING_START){ progressBarLandScape.setVisibility(View.VISIBLE); return true; } return false; } }); 

This is not the best way to do something, but it still works for me until I find a good streaming video service.

+9
Mar 10 '17 at 20:15
source share



All Articles