Change SimpleExoPlayerView and not display smooth
When I use demo, I add some code at onConfigurationChanged to switch play in different SimpleExoPlayerView, the code is
if(newConfig.orientation == ORIENTATION_LANDSCAPE){
simpleExoPlayerView.setPlayer(null);
player_view_full.setVisibility(View.VISIBLE);
player_view_full.setPlayer(player);
}else{
player_view_full.setVisibility(View.GONE);
player_view_full.setPlayer(null);
simpleExoPlayerView.setPlayer(player);
}
It show like this when I switch it to new SimpleExoPlayerView

And seconds later, it renders correctly, the screenshot is below:

I try it on more than 3 devices, they all act same,include NEXUS 6
my question is how to switch SimpleExoPlayerView correctly, and how to avoid the bad render experience in the first seconds, thank you.
I think this is fixed in r2.2.0. If you believe otherwise, please file a new issue including all of the information clearly requested in the issue template, since there is not enough information provided here for us to assist.
Thank you for your fast reply :)
I try it on r2.2.0 and image won't be fuzzy, it's great!
But there is a video render problem. When I switch, Image keeps still about seconds then start move,from the debug info, it tells that the video's renderedOutputBufferCount stop rising about seconds while audio's renderedOutputBufferCount keep rising.
How can I get a smooth switch SimpleExoPlayerView and won't be any video render image delay?
You can read a bit about why it's (unfortunately) difficult to do what you're trying to do in https://github.com/google/ExoPlayer/issues/2093, https://github.com/google/ExoPlayer/issues/1084 and https://github.com/google/ExoPlayer/issues/318. If possible you should handle the configuration change yourself as the demo app does, to avoid the problem. It's more work and you might have to do a bit of UI magic in code that would otherwise happen automatically, but it's possible. I'm fairly sure YouTube handles the orientation change itself, for example.
Thank you so much 👍
Similar problem with r2.2.0. After surface destroy->create with the same surface view and when called setPlayWhenReady(false) -> setPlayWhenReady(true) ExoPlayer just render next keyframe (in our source it is after 10 seconds). All that time sound plays, but video freezed on that keyframe.
On version r2.1.0 video was with artefacts however.
Note: workaround to this problem is call seekTo just before setPlayWhenReady(true)
i had the same problem. After surfaceview destroy->create with the same surfaceview .. sometimes, the SurfaceView will keep the frame when destory.
I'm also facing same issue @s-a--m, have you got any solution?
Finally I'm detected error happens when we call setPlayWhenReady before applying surface to player. Then after surface changed player stuck with old frame for some time.
So workaround would be call seek just after applying surface:
final ExoPlayer.ExoPlayerMessage message = new ExoPlayer.ExoPlayerMessage(videoRenderer, C.MSG_SET_SURFACE, surface);
player.blockingSendMessages(message);
if (surface != null) {
final long position = mPlayer.getCurrentPosition();
/*
Workaround ExoPlayer 2.2.0 bug
https://github.com/google/ExoPlayer/issues/2441
*/
mPlayer.seekTo(position-1);
}