1
String fileName = "android.resource://" + getPackageName() + "/raw/oryx1001";
MediaController videoMediaController = new MediaController(this);
//mVideoView.setVideoPath(Uri.parse());
mVideoView.setVideoURI(Uri.parse(fileName));
mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
return true;
}
});
videoMediaController.setVisibility(View.GONE);
videoMediaController.setMediaPlayer(mVideoView);
mVideoView.setMediaController(videoMediaController);
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
//Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
mVideoView.start();
}
});
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
//jump();
//System.out.println("dksadalkdakldsadlkadklsad");
mp.reset();
String fileName = "android.resource://" + getPackageName() + "/raw/oryx1001";
MediaController videoMediaController = new MediaController(MainActivity.this);
mVideoView.setVideoURI(Uri.parse(fileName));
mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
return true;
}
});
videoMediaController.setVisibility(View.GONE);
videoMediaController.setMediaPlayer(mVideoView);
mVideoView.setMediaController(videoMediaController);
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
mVideoView.start();
}
});
}
});
私のコード3gpファイルは機能しません。それはAndroidのoreoで動作しますが、lolipopデバイスやsamsung s6では動作しません。それはapiのものか、またはコーデックのデバイスのサポートですか?私はすべてのmp4を試して、3gp何も働いていない。 E/MediaPlayerの:エラー(-38,0) D/VideoView:エラー:-38,0 /MediaPlayerの:エラー(1、-38)E/MediaPlayer:エラー(-38,0)