无法播放此视频以引起轰动 android
cant play this video for splash android
您好,我为启动画面设置了一个视频,它显示在 android 4.4.4 上面,但它没有显示在 android 4.4.2
**这是我的代码**
videoView = findViewById(R.id.videoView1);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.splash);
videoView.setVideoURI(video);
videoView.setZOrderOnTop(true);
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
videoView.start();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(SplshScreen.this, MainActivity.class));
finish();
}
}, 1500);
logcat 上的错误:
Activity.SplshScreen has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{9d069060 V.E..... R.....ID 0,0-1026,318} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:348)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:286)
at android.app.AlertDialog$Builder.show(AlertDialog.java:951)
at android.widget.VideoView.onError(VideoView.java:515)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2248)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
提前致谢!
在 videoView.setVideoURI(video);
之后添加此代码段
videoView.setOnPreparedListener(this);
希望它有用。
您好,我为启动画面设置了一个视频,它显示在 android 4.4.4 上面,但它没有显示在 android 4.4.2
**这是我的代码**
videoView = findViewById(R.id.videoView1);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.splash);
videoView.setVideoURI(video);
videoView.setZOrderOnTop(true);
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
videoView.start();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(SplshScreen.this, MainActivity.class));
finish();
}
}, 1500);
logcat 上的错误:
Activity.SplshScreen has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{9d069060 V.E..... R.....ID 0,0-1026,318} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:348)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:286)
at android.app.AlertDialog$Builder.show(AlertDialog.java:951)
at android.widget.VideoView.onError(VideoView.java:515)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2248)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
提前致谢!
在 videoView.setVideoURI(video);
videoView.setOnPreparedListener(this);
希望它有用。