My android application can show streaming video. I have come across very strange behaviour of videoView. VideoView's playback can be started/paused via button, code is:
playPause.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
boolean isPlaying = isChecked;
if (isPlaying)
{
videoView.pause();
}
else
{
videoView.start();
}
}
});
I call videoView.pause() to stop playing and videoView.start() to begin/continue playing. I tested this code on 3 devices:
1) Nexus 7, Android 4.2: play works fine, pause works fine, videoView.canPause() returns true.
2) Samsung Galaxy S3, Android 4.1: play works fine, pause doesn't stop the video, canPause() returns true.
3) LG P-350, Android 2.2 - play works fine, pause doesn't work, .canPause() returns false.
So, I can understand why it cant be paused on P-350 - because canPause is false. But what's going on with Galaxy S3 (or android 4.1 - I dont know what is the reason of such behaviour)? This is just mess... how to make this working on all devices not only on some of them?
P.S. If I call .suspend()/.resume(), video is being buffered even if we stay at the same position, so this is not an option.