Java Code Examples for org.webrtc.SurfaceViewRenderer#setZOrderMediaOverlay()

The following examples show how to use org.webrtc.SurfaceViewRenderer#setZOrderMediaOverlay() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Peer.java    From webrtc_android with MIT License 6 votes vote down vote up
public void createRender(EglBase mRootEglBase, Context context, boolean isOverlay) {
    renderer = new SurfaceViewRenderer(context);
    renderer.init(mRootEglBase.getEglBaseContext(), new RendererCommon.RendererEvents() {
        @Override
        public void onFirstFrameRendered() {
            Log.d(TAG, "createRender onFirstFrameRendered");

        }

        @Override
        public void onFrameResolutionChanged(int videoWidth, int videoHeight, int rotation) {
            Log.d(TAG, "createRender onFrameResolutionChanged");
        }
    });
    renderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
    renderer.setMirror(true);
    renderer.setZOrderMediaOverlay(isOverlay);
    sink = new ProxyVideoSink();
    sink.setTarget(renderer);
    if (_remoteStream != null && _remoteStream.videoTracks.size() > 0) {
        _remoteStream.videoTracks.get(0).addSink(sink);
    }

}
 
Example 2
Source File: CustomWebSocketListener.java    From WebRTCapp with Apache License 2.0 6 votes vote down vote up
private void createVideoView(final RemoteParticipant remoteParticipant) {
    Handler mainHandler = new Handler(videoConferenceActivity.getMainLooper());

    Runnable myRunnable = new Runnable() {
        @Override
        public void run() {
            View rowView = videoConferenceActivity.getLayoutInflater().inflate(R.layout.peer_video, null);
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            lp.setMargins(0, 0, 0, 20);
            rowView.setLayoutParams(lp);
            int rowId = View.generateViewId();
            rowView.setId(rowId);
            views_container.addView(rowView);
            SurfaceViewRenderer videoView = (SurfaceViewRenderer)((ViewGroup)rowView).getChildAt(0);
            remoteParticipant.setVideoView(videoView);
            videoView.setMirror(false);
            EglBase rootEglBase = EglBase.create();
            videoView.init(rootEglBase.getEglBaseContext(), null);
            videoView.setZOrderMediaOverlay(true);
            View textView = ((ViewGroup)rowView).getChildAt(1);
            remoteParticipant.setParticipantNameText((TextView) textView);
            remoteParticipant.setView(rowView);
        }
    };
    mainHandler.post(myRunnable);
}
 
Example 3
Source File: RCConnection.java    From restcomm-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initializeVideo(boolean videoEnabled, PercentFrameLayout localRenderLayout, PercentFrameLayout remoteRenderLayout)
{
   if (localRenderLayout == null ||remoteRenderLayout == null) {
      return;
   }

   scalingType = ScalingType.SCALE_ASPECT_FILL;

   this.localRenderLayout = localRenderLayout;
   this.remoteRenderLayout = remoteRenderLayout;

   localRender = (SurfaceViewRenderer)localRenderLayout.getChildAt(0);
   remoteRender = (SurfaceViewRenderer)remoteRenderLayout.getChildAt(0);

   localRender.init(peerConnectionClient.getRenderContext(), null);
   localRender.setZOrderMediaOverlay(true);
   remoteRender.init(peerConnectionClient.getRenderContext(), null);
   updateVideoView(VideoViewState.NONE);
}
 
Example 4
Source File: WebRTCEngine.java    From webrtc_android with MIT License 5 votes vote down vote up
@Override
public View startPreview(boolean isOverlay) {
    localRenderer = new SurfaceViewRenderer(mContext);
    localRenderer.init(mRootEglBase.getEglBaseContext(), null);
    localRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
    localRenderer.setMirror(true);
    localRenderer.setZOrderMediaOverlay(isOverlay);

    localSink = new ProxyVideoSink();
    localSink.setTarget(localRenderer);
    if (_localStream.videoTracks.size() > 0) {
        _localStream.videoTracks.get(0).addSink(localSink);
    }
    return localRenderer;
}