0

I have been developing video advertisement android app, but I need one help to play HD videos in VideoView in android version 4.2.2. I have download the all the videos in internal storage and I have to play this video in one screen like this

I have download the all the videos in internal storage and I have to play this video in one screen like this

But now some video is in Full HD and that video is not playing in video view in specially android version 4.2.2 and detect the error like this

E/MediaPlayer: Error (-38,0)

so what should I do, I have search many things or many github libraries like ExoPlayer , EasyPlayer but in this library is also not playing Full HD Videos in android version 4.2.2.

I need help.

I have been playing video in VideoView with following code.

MediaController controller = new MediaController(this);
videoView.setVideoURI(Uri.parse(pathVideo));
        videoView.setMediaController(controller);
        controller.setMediaPlayer(vv);
        videoView.setOnPreparedListener((MediaPlayer.OnPreparedListener) mContext);
        videoView.setOnCompletionListener((MediaPlayer.OnCompletionListener) mContext);
        videoView.setOnErrorListener((MediaPlayer.OnErrorListener) mContext);
        videoView.start();
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • 3
    Possible duplicate of [Media Player called in state 0, error (-38,0)](https://stackoverflow.com/questions/9008770/media-player-called-in-state-0-error-38-0) – Tigger Dec 26 '17 at 09:29
  • I don't think so because when I play law resolution type of video like 320p,420p then it's play fine in video view using this code. – Bhargav Parmar Dec 26 '17 at 09:33
  • This error (-38,0) and Can't play video error show when I play HD videos like 720p and 1080p I have attached the sample video link to get an idea about video resolution Link : https://www.youtube.com/watch?v=44rTTLjZZz4 – Bhargav Parmar Dec 26 '17 at 09:36
  • Have you tested the answer in the possible duplicate? There is a huge difference in memory usage between 420p and 720p and that is what the `MediaPlayer.setOnPreparedListener()` and `MediaPlayer.prepareAsync()` are doing. Caching the video so it can be played without a crash. Simply calling `.start()` is not good enough for HD video. – Tigger Dec 26 '17 at 09:39
  • ok have to do this MediaPlayer.prepareAsync() in comman method of onPrepared like this @Override public void onPrepared(MediaPlayer mp) { if (mp.isPlaying()) { mp.stop(); mp.release(); mp = new MediaPlayer(); } mp.prepareAsync(); mp.start(); } but now detect one more error is : E/MediaPlayer: prepareAsync called in state 8 – Bhargav Parmar Dec 26 '17 at 10:09
  • Finally i get the libraries for playing HD video in android version 4.2.2, Link : https://github.com/tcking/GiraffePlayer , But now i have facing one more issue is when i play two video in same screen than at the time any one video is play another video stay on push mode so how i do this? to play two video at the same time. – Bhargav Parmar Dec 28 '17 at 07:32

0 Answers0