Reputation: 69
I use EasyVideoPlayer library in my Android application, when the video appears doesn't see the video, I only view a black screen. But when I rotate the screen to portrait or landscape it works perfectly. I don´t know what is the problem...
My code:
EasyVideoPlayer vVideo = (EasyVideoPlayer) findViewById(R.id.vVideo);
vVideo.setCallback(this);
vVideo.setSource(Uri.parse(url));
vVideo.setAutoPlay(true);
vVideo.start();
Thanks in advance
Upvotes: 0
Views: 54
Reputation: 25511
When you rotate the device, unless you have orientation locked which does not sound like it is there case, Android will kill your activity and restart it.
The reason it does this is to allow the activity be recreated with the correct resources for the new orientation - in fact it does the same thing for other configuration changes also, such as a language change.
So, take a look at the code that gets called when your activity is destroyed and recreated, in particular 'onCreate', 'onResume' etc - you will most likely find that something is being done here which allows the video to play correctly but which is missing when you hit the 'play' button normally.
Upvotes: 1