I implemented in my application the ability to view video via url using VideoView.
videoView = (VideoViewCustom) findViewById(R.id.surface_view); mediaController = new MediaController(this); videoView.setVideoURI(Uri.parse(bundle.getString("incPath"))); mediaController.setAnchorView(videoView); videoView.setMediaController(mediaController); videoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { videoView.start(); mProgress.setVisibility(View.GONE); } });
Faced the following problem:
Many users complain that some videos are not being played and movies may produce an error at different times (video cannot be played). All videos including movies (.mp4 H.264). For the sake of tests, I downloaded non-working videos and watched them on these devices as usual (i.e. outside the application) and no errors occurred. I understand the problem is not in codecs. In parallel with watching the videos, I ping the server and the pings did not disappear while the same infamous one appeared (sorry video cannot be played).
I have 2 options
- Can I use MediaPlayer instead of VideoView?
- Or maybe just html5 player shove into the webview.
Maybe the above will seem nonsense, and it is not known in general whether the error will repeat, but I just don’t know where to dig. If, who knows please, tell me an alternative (if any). And in general, how to deal with it.