Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making video load faster in videoview

I play a video in a videoview from an URL...everything works fine and even the video plays

But the only problem is that the video takes almost 10 seconds to start playing which might be kind of annoying to the user

I have tried different URLs and its the same, the videos are 360p and 6sec long

Is it the default media player that is slow?

I have the stack overflow but could not find a suitable answer and ever searched for various 3 rd party videos libraries but could not find one

Even tried google's exoplayer library but the documentation is not that good in my view

Is there any solution how to overcome this problem?

my code

    public class MainActivity extends Activity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            String videeourl = "http://techslides.com/demos/sample-videos/small.3gp";

            VideoView videoView = (FastVideoView)findViewById(R.id.video);
            videoView.setMediaController(new MediaController(this));
            videoView.setVideoPath(videeourl); 

            videoView.start();
        }
    }
like image 655
user5894647 Avatar asked Oct 18 '22 14:10

user5894647


1 Answers

Consider using Exoplayer. You can find the open source project here: https://github.com/google/ExoPlayer

It uses Dynamic Adaptive Streaming over HTTP (DASH),breaks long content into HTTP segments.

like image 88
Susheel Avatar answered Oct 21 '22 11:10

Susheel