Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change SimpleExoPlayerView and not display smooth #2441

Closed
walksin opened this issue Feb 12, 2017 · 8 comments
Closed

Change SimpleExoPlayerView and not display smooth #2441

walksin opened this issue Feb 12, 2017 · 8 comments

Comments

@walksin
Copy link

walksin commented Feb 12, 2017

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
image

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

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.

@ojw28
Copy link
Contributor

ojw28 commented Feb 13, 2017

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.

@walksin
Copy link
Author

walksin commented Feb 13, 2017

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?

@ojw28
Copy link
Contributor

ojw28 commented Feb 13, 2017

You can read a bit about why it's (unfortunately) difficult to do what you're trying to do in #2093, #1084 and #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.

@walksin
Copy link
Author

walksin commented Feb 13, 2017

Thank you so much 👍

@samoylenkodmitry
Copy link
Contributor

samoylenkodmitry commented Feb 14, 2017

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)

@ghost
Copy link

ghost commented Feb 20, 2017

i had the same problem.
After surfaceview destroy->create with the same surfaceview .. sometimes, the SurfaceView will keep the frame when destory.

@thackerronak
Copy link

I'm also facing same issue @s-a--m, have you got any solution?

@samoylenkodmitry
Copy link
Contributor

samoylenkodmitry commented May 22, 2017

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);
			}

@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants