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.
grant Mar 10 '17 at 20:15 2017-03-10 20:15
source share