Video not rendering properly on Nexus 7(2nd gen) when switching from one SimpleExoPlayerView to another one within a couple seconds of playback starting
Issue description
After upgrading from ExoPlayer 2.4.4 to 2.5.1 we are having an issue with Nexus 7 devices not switching properly from one SimpleExoPlayerView to another one. What we get is basically a gray screen with a couple old frames on top of the screen partly visible.
Reproduction steps
This behavior occurs if the user rotates the screen during the first few seconds from starting the playback during which the application recreates the player fragment that contains the SimpleExoPlayerView and sets the player for the new SimpleExoPlayerView instance.
This issue is 100% reproducible on our app after upgrading to version 2.5.1 of ExoPlayer and causes the playback to lock up and the artifacts from the video surface remain even in the device homescreen if the user is able to navigate away from the app when this happens.
Link to test content
Test content shouldn't matter but I can provide a link to one of our live HLS streams through email.
Version of ExoPlayer being used
2.5.0, 2.5.1, also tested using dev-v2 branch
Device(s) and version(s) of Android being used
Nexus 7 (2nd gen), Android 6.0.1
A full bug report captured from the device
Will include this in the email as well.
I doubt this worked particularly well prior to 2.5.1 either (there would have likely been a noticeable delay before video started again after the rotation)?
If at all possible, you'll likely find the experience is much better if you can handle the orientation change yourself and avoid recreating the activity. How feasible that is depends on how complex your UI is, and how much of it you need to swap out as a result of the orientation change.
The reason the behavior is different now is likely a result of DummySurface (actually intended to make this type of case more seamless, but apparently not working quite right on all devices). We'll try and reproduce, and revert back to the old behaviour just for this device if that's the best course of action.
Yeah it's true that on previous versions the change wasn't as seamless as it is in the newer versions and the user experience is much better on most devices that we have tested but unfortunately it seems to introduce a new issue at least on this device.
I think we should re-evaluate if we can have a common layout for landscape and portrait orientation in the future to make it more compatible with all devices but at the moment due to the app design the portrait and landscape layouts of the player activity differ quite a lot so it isn't really that simple to handle the change manually.
Reproduced. It's really quite bad :(. Will blacklist use of DummySurface for this device. Thanks for reporting!
It's actually not DummySurface causing the issue, since the same problem happens switching directly between two real Surface instances. We probably need to disable use of MediaCodec.setOutputSurface on this device.
Should be fixed in dev-v2. Please verify!
Works great in dev-v2 now. Thanks for the quick fix.
We've found the same issue with Sony F3311 (Sony Xperia E5) with decoder OMX.MTK.VIDEO.DECODER.AVC.