5

I already found a similar question here but that was asked almost 2 years ago. Currently, I am working on a video streaming app for Android and I was thinking if using Firebase to host the videos is a viable option.

I tried using the URL of the video stored in Firebase storage to play the video in my app and it is working just fine.

But I searched online and found that everybody is advising not to use Firebase for the same. Is there any particular reason why Firebase shouldn't be used for this purpose?

P.S. In my case, all the videos that need to be streamed will be in HD and will have a longer time duration.

Any help will be appreciated. Thanks in advance.

Mehul Kanzariya
  • 888
  • 3
  • 27
  • 58
  • Yes you cam stream video using th download url. Just copy it and pass it into videoview. I use exo player to play most of the file format. Yes pricing is high but you can afford it with in app purchases. Watch whole explanation here. https://youtu.be/EaJHJK6Vzqg – Dheeraj Anand Jul 01 '19 at 20:23

4 Answers4

3

Firebase Storage does not place restrictions on the type of files you can upload to it. So you can upload video files with no problem. However, if you are expecting to be able to stream the video out in different formats for different types of clients, you might be disappointed. You should think of Firebase Storage mostly as a general file storage solution, not a video streaming solution.

And Also with consideration of the firebase usage costings, you probably will have to pay a lot of money as your userbase grows.

read here and here

Lakshan Dissanayake
  • 521
  • 1
  • 4
  • 18
  • 1
    The links to the answers that you have provided are almost 2 years ago which I mentioned in the question. I wanted to know that if Firebase has added or improved the support for video streaming in this last 2 years? – Mehul Kanzariya Apr 22 '19 at 04:10
3

In order to stream videos it's better to use some streaming protocol like DASH of HLS, as it will load the next video chunk adaptively according to network speed etc.

If you have any thoughts of supporting iOS as well, you'd want to choose HLS which is supported on Android and iOS.

There's a way to host HLS videos for streaming on Firebase Cloud Storage, as I wrote in this answer: Firebase Storage Video Streaming

syonip
  • 2,762
  • 25
  • 27
0

Nope, Firebase developers haven't realeased anything related to video streaming support. I'm actually using the storage as you. First I download it and save it in a local file:

private fun downLoadVideosLocal(firebaseStorageUrl: String): String {
    // Getting the data from storage from uri
    val videoRef = storage.getReferenceFromURL(firebaseStorageUrl)

    // Download video to local file
    try {
        val localFile = File.createTempFile("videos", "mp4")

        videoRef.getFile(localFile).addOnSuccessListener {
            // Local temp file has been created
            Log.v("VideoDownloaded", "The video was downloaded")
        }.addOnFailureListener {
            // Handle any error
            Log.v("VideoDownloaded", "File Failure")
        }
        return localFile.absolutePath
    } catch (e: IOException) {
        e.printStackTrace()
        return ""
    }
}

Then I play it on a videoView parsing the absolutePath into Uri so that I can use the setVideoUri() method and that's it.

What I'm gonna do next is create the video streamming server on Linux to avoid many costs of downloading the video. Because I might download many videos to 200 or more clients. I hope Firebase or Google developers implement a video streamming server in the future. Also you can use Youtube Api but what if you don't want your videos might been seen by other people??? XD

0

Yes, video streaming from firebase is easy and possible.

Depending on your use case protocols like HLS or DASH can be used. But this is not necessary.

See my answer from the other question here.

Skyy2010
  • 795
  • 7
  • 19