0

Good evening, I have a following problem. I want to play a video format * .3gp in VideoView. I I've tried to use this code:

  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.mylay);
  VideoView videoHolder = new VideoView(this);
  videoHolder = (VideoView) findViewById(R.id.videoView1);
  Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.asd);
  videoHolder.setVideoURI(video);
  videoHolder.setOnPreparedListener(new OnPreparedListener() {
   public void onPrepared(MediaPlayer mp) {
        mp.start();
        mp.setLooping(true);
   }
  });
}

Everything is working fine on emulators and HTC Desire S. But there is a Chinese tablet Onda V972, which gives me an "error when playing video" every time:

06-19 18:34:18.890: W/AudioSystem(25145): AudioFlinger server died!
06-19 18:34:18.890: W/IMediaDeathNotifier(25145): media server died
06-19 18:34:18.890: E/MediaPlayer(25145): error (100, 0)
06-19 18:34:18.890: E/MediaPlayer(25145): Error (100,0)
06-19 18:34:18.890: D/VideoView(25145): Error: 100,0

Please tell me if this problem can be solved. Thank you so much. Maybe there's another way to load the video file into VideoView?

UPDATE 21.06:

Just updated firmware of my tablet, now the video is playing but not looping. I've tried the following code but the rusult is the same - HTC and emulators are doing well but tablet doesn't loop the video. I've tried *.mp4 also, all the same:

VideoView videoHolder = new VideoView(this);
videoHolder = (VideoView) findViewById(R.id.videoView1);
// videoHolder.setMediaController(new MediaController(this));
Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.asd);
videoHolder.setVideoURI(video);
// setContentView(videoHolder);

videoHolder.setOnPreparedListener(new OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
        mp.setLooping(true);
        mp.start();
    }
});

videoHolder
        .setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                mp.mp.seekTo(0);
                mp.start();
            }

        });

The question is - how can I make the video looping on all devices?

1 Answers1

0

try like that videoview set with media controller

public class HelloInterruptVideoStream extends Activity
{
    private String path = "http://dl.dropbox.com/u/145894/t/rabbits.3gp";
    private VideoView videoview;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        videoview = (VideoView)findViewById(R.id.surface_view);

        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

        videoview.setVideoURI(Uri.parse(path));
        videoview.setMediaController(new MediaController(this));
        videoview.requestFocus();
        videoview.start();

    }
}
Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50
  • Unfortunately the effect is the same. Seems to be that there is a lot of devices like that, and I'd really want the video to work on all devices correctly.. – Pavel Plaxin Jun 20 '13 at 17:31