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

  1. Can I use MediaPlayer instead of VideoView?
  2. 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.

    1 answer 1

    Android does not support all video codecs and not all video formats. In addition, there are restrictions on streaming video over HTTP, so that the video on your device means absolutely nothing. Moreover, some devices can support above the standard list (it is possible that less than the standard list). A list of standard restrictions is here.

    I would recommend to catch the error of streaming and intelligently inform the user that there is a problem. You can use the VideoView.setOnErrorListener() function to catch streaming errors.

    • Thank you for responding! But I do not streaming, I have a banal reading on legal entities. I tried to catch. I will say this, it catches this function very, very badly (I know from personal experience). Please tell me, can the options suggested above be considered? In particular, html5 - Sever