我正在尝试使用VideoViewer播放视频的Android应用程序:
mainActivityView.videoView.setMediaController(new MediaController(this));
mainActivityView.videoView.setVideoPath("/Movies/" + "video1.mp4");
mainActivityView.videoView.requestFocus();
mainActivityView.videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mainActivityView.videoView.start();
}
});
mainActivityView.videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mainActivityView.videoView.setVisibility(View.INVISIBLE);
mainActivityView.videoView.setVideoPath("");
}
});
但是我一直遇到运行时错误:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
然而,在错误之前,我看到了红色:
03-25 23:00:55.833 5106-5106/com.passa.videobooth E/MediaPlayer-JNI﹕ QCMediaPlayer mediaplayer NOT present
03-25 23:00:55.853 5106-5118/com.passa.videobooth E/MediaPlayer﹕ error (1, -2147483648)
我试过在互联网上试图找出这是什么或没有运气的意思。请帮助!