Does anyone know why me application only returns wrong values when printing out the variables within the VideoView?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView video = (VideoView)findViewById(R.id.introvideo);
VideoThread IntroClip = new VideoThread();
IntroClip.execute(video);
}
private class VideoThread extends AsyncTask<VideoView, Integer, VideoView> {
@Override
protected VideoView doInBackground(VideoView... video) {
video[0].setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.intro);
return video[0];
}
protected void onPostExecute(VideoView video) {
video.start();
}
}
If I try to print video.getheight it is always 0, video.IsPlaying is always false and so on.
I have to find out when the video has stopped playing. In other words something like this in the onCreate-method:
while(video.IsPlaying())
{
}
/*Stopped playing, continue...*/
But the value is as mentioned always false :-/
Found a solution:
Refer to How to start activity after VideoView end
Greetings!