-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Android 7 and bellow problem displaying a player over another using surfaceView #7999
Comments
@andrewlewis, @ojw28 then you seem to have the most experience with dealing with surfaceView vs textureView on old devices. Do you have an idea if a workaround exist for overlaying surfaceView on old Android devices? |
In case you haven't tried them already, here are a couple of suggestions:
If those don't work then I'm not aware of other easy ways that might fix this, as it seems like a limitation of the underlying windowing/graphics system. The only other suggestion I have is to have the videos render to off-screen |
Thank you I'll revise all of that, if I find a solution I post here a update with it. |
The function I endup using is the bellow only use for private void ResetViewOrder(PlayerView ViewOnTop, PlayerView ViewOnBottom) {
//Make sure both views are inside the same layout, pass the parent or use the below to get it
ViewGroup parent = (ViewGroup) ViewOnTop.getParent();
parent.bringChildToFront(ViewOnTop);
SurfaceView TopSurfaceView = (SurfaceView) ViewOnTop.getVideoSurfaceView();
SurfaceView BottomSurfaceView = (SurfaceView) ViewOnBottom.getVideoSurfaceView();
if (TopSurfaceView != null && BottomSurfaceView != null) {
//Remove both PlayerView to fully reset the order, with just setZOrderMediaOverlay or even setZOrderOnTop the effect will not work on Android 7 and older OS
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
parent.removeView(ViewOnBottom);
parent.removeView(ViewOnTop);
}
TopSurfaceView.setZOrderMediaOverlay(true);
BottomSurfaceView.setZOrderMediaOverlay(false);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
parent.addView(ViewOnBottom);
parent.addView(ViewOnTop);
}
}
} |
Issue description
On my app I display a player in front of another, on Android 7 or bellow when using
surfaceView
the player that is in front can't be seen, usingtextureView
no problem see video bellow....https://www.youtube.com/watch?v=tIcyWjiVhLg&feature=youtu.be
On that video the player first start using
textureView
all the player are visible, even when front of it other, after I change fromtextureView
tosurfaceView
(disabling the app settings "Picture in Picture old OS workaround") we can't see the player that is front anymore.Yes the layout is properly created, meaning that the player that must be in front is in always in front.
I know this is probably a old OS problem, but maybe can be improved and
surfaceView
can be used, so old devices using my app don't need workarounds.I have this issue fgl27/SmartTwitchTV#13, where a old device
Amazon Fire Stick Gen 2
(running android SDK 22) lags (drops a lot of frames) when usingtextureView
wiling playing a single video, that may be a device issue, but the user needs to force disable the settings "Picture in Picture old OS workaround" to avoid lags, and after that can't use any Picture in Picture mode that the app has as the players aren't visible as there is the old OS issue.Reproduction steps
Try to display a
PlayerView
over another usingsurfaceView
on Android 7 or bellow.Link to test content
I'm playing HLS live streams, I assume the link is not applicable, as my link do expire I share one on request.
A full bug report captured from the device
As this is a visual problem that can be reproduce on the emulator of Android Studio, I assume a bug report is not applicable, if requested I generate one from the emulator
Version of ExoPlayer being used
dev-v2
Device(s) and version(s) of Android being used
Android emulator X86 API 23
Android 6
Also tested on devices as for example Moto G second generation running Android 6, same problem
The text was updated successfully, but these errors were encountered: