I had a file in .wmv format and the size of 480 * 800 I reproduce this file in VideoView using this method

 private void playVideo(){ videoView.setKeepScreenOn(true); // Here i set a path to video file String videoSource = "android.resource://com.example.android.camera2basic/" + R.raw.movie; videoView.setVideoURI(Uri.parse(videoSource)); videoView.setMediaController(null); videoView.setOnCompletionListener(myVideoViewCompletionListener); videoView.setOnPreparedListener(myVideoViewPreparedListener); } 

After the file was changed (the duration was added), it remained in the same .wmv format, but the size was 808 * 1440 and now when I play the video there is no picture, but the video goes ...

I read and understood that the problem may be in high resolution ...

And here's a question:

  1. What resolution should this file be in order to play on all devices?
  2. Or do you need to adjust it programmatically like that?

    2 answers 2

    I just converted the format to MP4 and it all worked ...

    Some more Sevets from senior developers:

    1. Store the file you need in the file system of the phone
    2. His resolution should be as small as possible, but sufficient ...

      The resolution does not matter if the XML file does this:

        android:layout_width="match_parent" android:layout_height="wrap_content" 
      • And what is the difference? I have now android: layout_width = "match_parent" android: layout_height = "match_parent" ... What will change? - Aleksey Timoshchenko
      • I now also work on a video player, I have pro expertised it and it turned out that any resolution and format fit the screen, and with android: layout_width = "match_parent" android: layout_height = "match_parent" some videos are distorted - It Alexander
      • If I understood correctly, if I set match_parent in height and width, then the picture may be distorted, so it’s better to set wrap_content in height, right? - Aleksey Timoshchenko
      • Yes, there is. Tested the hard way - It Alexander