3

I have been searching a lot about this by now and I got nothing:

I am trying to play a video from firebase storage and trying to be able to see its progress on the player as it loads and to be able to seek it backward and forward (stuff that any player does while streaming a video).

The problem:

Firebase team say that it is not possible to stream a video from the cloud storage (it is not supported).

Eventhough I was able to do this:

String url = "my_url_at_firebase_storage";

video_View.setVideoUri(Uri.parse(url));
video_View.start();

and I was able to load the video from firebase storage into a video view.

I checked:

I checked this link that has an answer that says you have to transcode the video to chunks and save the chuncks to firebase storage and then load them:

But I am lost here:

1) What are chunks of video?

2) How would you stream these chunks if firebase doesn't support streaming?

My question:

As this topic is rarely documented and the link above doesn't provide enough info about how to acheive it:

I ask:

If firebase doesnt support streaming how come we are able to load video directly to videoview?

Tried the same with exoplayer and didn't work?

Thanks for your efforts.

data
  • 739
  • 6
  • 17

1 Answers1

2

"Transcoding the video into chunks" means dividing it into multiple small pieces (separate files). Those parts are then uploaded to Firebase Cloud Storage.

Once you divided the video into those pieces, you can download them. Since Firebase does not support streaming, you have to download each chunk entirely before playing, but the trick is that you only have to download that chunk, not the entire video.

Does that answer your question?

vatbub
  • 2,713
  • 18
  • 41
  • It doesnt seem a clean way to do it? because you need to download the files locally before playing them. – data Jul 23 '18 at 14:11
  • And not clean becuase then how would you properly seek, and how to see the loading on the progress bar like youtube? – data Jul 23 '18 at 14:14
  • 1
    Yeah but streaming is technically a download, too. You preload a part of the video, store it locally and then delete it afterwards. The only reason that it appears to the user as a stream is because the video is deleted immediately after the playback. – vatbub Jul 23 '18 at 14:14
  • And seeking and showing the preloading progressin the seekbar would be your job to implement :) – vatbub Jul 23 '18 at 14:15
  • How would we go about referencing the files downloaded when seeking....do i have to create my own player? – data Jul 23 '18 at 14:15
  • Eventhough lets say while I started the video I directly seeked to the end of the video....then how would I know what chunk is to be played? – data Jul 23 '18 at 14:18
  • You would need to create some kind of index when transcoding the files that contains the information about what chunk contaisn which parts of the video. That index could then be uploaded to Firebase e. g. as an XML-File. YOu then download that XML file which tells you what chunks to get. – vatbub Jul 23 '18 at 14:20
  • Creating a player that does this seems alot of work? – data Jul 23 '18 at 14:22
  • It's probably not something that you do in one day but since you're probably not the only person solving such an issue, there might be a library for that already. – vatbub Jul 23 '18 at 14:23
  • BTW would you mind marking my answer as the solution if it helped you out? Thanks :) – vatbub Jul 23 '18 at 14:24