we are currently testing sinch sdk for android (v3.12.3) and experiencing following issue: the local view is always placed above other views even if it comes first in view hierarchy and should be beneath views that come later - we want to show local video fullscreen and remotevideo as picture-in-picturue - in this case local fullscreen video covers the pip-view. Consider simple layout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<FrameLayout android:id="@+id/fullscreen_video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<FrameLayout
android:id="@+id/pip_video_view"
android:layout_width="150dp"
android:layout_height="112dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"/>
Pip-View comes last and should be usually above Fullscreen-View. But if we add local video to Fullscreen-View - it covers the Pip-View. Adding local video to Pip works as expected - Pip is above Fullscreen. The Problem is reproducible both on Android Emulator with Android 6.0 and on real device (Samsung Tablet with Android 4.4)
I've found a workaround for the problem. I cannot call it a real solution since it relies on certain type of view being returned from VideoController
View remoteView = vc.getRemoteView();
if (remoteView instanceof SurfaceView) {
((SurfaceView) remoteView).setZOrderOnTop(true);
}
as long as remote view is of type SurfaceView (it is actuall GLSurfaceView), we can make it appear above all windows with setZOrderOnTop. I cannot call it real solution since there is no guarantee that the view returned from getRemoteView will always be SurfaceView (or will provide access to surfaceview). For instance getLocalView returns a wrapper view around surfaceview so there is no legal access to it. I think the possible solution would be to return a "special" view that allows setZOrderOnTop and/or setZOrderMediaOverlay calls on it (you can name the methods different to explain their meaning more clear)