不知道该怎么做。我的mp4.video适用于大多数设备但模拟器我从logcat给我这个错误消息:
03-28 09:42:36.745 21332-21332/com.m D/MediaPlayer: getMetadata
03-28 09:42:36.766 21332-21346/com.m E/MediaPlayer: error (1, -38)
03-28 09:42:36.768 21332-21347/com.m E/MediaPlayer: error (1, -38)
03-28 09:42:36.810 21332-21332/com.m E/MediaPlayer: Error (1,-38)
03-28 09:42:36.810 21332-21332/com.m D/VideoView: Error: 1,-38
我还有一个旧的API 15设备,它给我以下错误:
03-28 10:09:04.174 12122-12122/com.m E/MediaPlayer: Error (1,-22)
03-28 10:09:04.174 12122-12122/com.m D/VideoView: Error: 1,-22
代码:
getWindow().setFormat(PixelFormat.UNKNOWN);
mVideoView = (VideoView)findViewById(R.id.account_upsell_video);
if ( mVideoView != null ) {
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(final MediaPlayer mp) {
mIsVideoPrepared = true;
mp.setLooping(true);
mp.start();
}
});
final MediaController ctrl = new MediaController(getContext());
ctrl.setVisibility(View.GONE);
mVideoView.setMediaController(ctrl);
final String url = String.format(Locale.getDefault(), "android.resource://%s/%d", getPackageName(), R.raw.intro);
mVideoView.setVideoURI( Uri.parse( url ) );
使用我的代码,从这里开始做的一些具体建议是< 3 Regards