I am working on an Android application trying to play a video with VideoViewer:
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("");
}
});
but I keep getting a crash with a run time error:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
However before the error I am seeing this in red:
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)
I have tried searching the internet trying to figure out what this is or means with no luck. Please Help!