To start with:
Make sure that video in Storage is actually in a format that Android devices can play.
VideoView
can play only the types of
videos that Android supports[
^].
private var path = "https://firebasestorage.googleapis.com/v0/b/video-app-af9bf.appspot.com/o/Videos%2FVideo_20200812_141638_.mp4?alt=media&token=d87f94e0-6ca3-4de2-856c-b228884185f7"
val view = fragmentview.findViewById<VideoView>(R.id.v)
val uri = Uri.parse(path)
view.setVideoURI(uri)
view.requestFocus()
view.start();
You are passing the uri directly into the
VideoView
. This would mean you are trying to stream the video from the given uri. Firebase Storage doesn't support video streaming, thus the issue. Streaming from a uri requires that the server on the other end be able to stream the given resource.
Since you want to play a video from Storage, you'll have to:
1. download the entire file first
2. save it to a local storage
3. then pass this local storage file path to the VideoView for playback.
For an easy test, pass the hard coded local url to your VideoView and see for yourself.
Try out.