Search in sources :

Example 6 with SurfaceViewRenderer

use of org.webrtc.SurfaceViewRenderer in project talk-android by nextcloud.

the class CallActivity method gotRemoteStream.

private void gotRemoteStream(MediaStream stream, String session) {
    removeMediaStream(session);
    if (stream.videoTracks.size() == 1) {
        VideoTrack videoTrack = stream.videoTracks.get(0);
        try {
            RelativeLayout relativeLayout = (RelativeLayout) getLayoutInflater().inflate(R.layout.surface_renderer, remoteRenderersLayout, false);
            relativeLayout.setTag(session);
            SurfaceViewRenderer surfaceViewRenderer = relativeLayout.findViewById(R.id.surface_view);
            surfaceViewRenderer.setMirror(false);
            surfaceViewRenderer.init(rootEglBase.getEglBaseContext(), null);
            surfaceViewRenderer.setZOrderMediaOverlay(false);
            // disabled because it causes some devices to crash
            surfaceViewRenderer.setEnableHardwareScaler(false);
            surfaceViewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
            surfaceViewRenderer.setOnClickListener(videoOnClickListener);
            VideoRenderer remoteRenderer = new VideoRenderer(surfaceViewRenderer);
            videoTrack.addRenderer(remoteRenderer);
            remoteRenderersLayout.addView(relativeLayout);
            gotNick(session, getPeerConnectionWrapperForSessionId(session).getNick());
        } catch (Exception e) {
            Log.d(TAG, "Failed to create a new video view");
        }
    }
    callControls.setZ(100.0f);
}
Also used : SurfaceViewRenderer(org.webrtc.SurfaceViewRenderer) VideoRenderer(org.webrtc.VideoRenderer) VideoTrack(org.webrtc.VideoTrack) RelativeLayout(android.widget.RelativeLayout) IOException(java.io.IOException)

Example 7 with SurfaceViewRenderer

use of org.webrtc.SurfaceViewRenderer in project matrix-android-sdk by matrix-org.

the class MXWebRtcView method setMirror.

/**
 * Sets the indicator which determines whether this {@code WebRTCView} is to
 * mirror the video represented by {@link #videoTrack} during its rendering.
 *
 * @param mirror If this {@code WebRTCView} is to mirror the video
 *               represented by {@code videoTrack} during its rendering, {@code true};
 *               otherwise, {@code false}.
 */
public void setMirror(boolean mirror) {
    if (this.mirror != mirror) {
        this.mirror = mirror;
        SurfaceViewRenderer surfaceViewRenderer = getSurfaceViewRenderer();
        surfaceViewRenderer.setMirror(mirror);
        // SurfaceViewRenderer takes the value of its mirror property into
        // account upon its layout.
        requestSurfaceViewRendererLayout();
    }
}
Also used : SurfaceViewRenderer(org.webrtc.SurfaceViewRenderer)

Example 8 with SurfaceViewRenderer

use of org.webrtc.SurfaceViewRenderer in project matrix-android-sdk by matrix-org.

the class MXWebRtcView method setScalingType.

private void setScalingType(ScalingType scalingType) {
    SurfaceViewRenderer surfaceViewRenderer;
    synchronized (layoutSyncRoot) {
        if (this.scalingType == scalingType) {
            return;
        }
        this.scalingType = scalingType;
        surfaceViewRenderer = getSurfaceViewRenderer();
        surfaceViewRenderer.setScalingType(scalingType);
    }
    // Both this instance ant its SurfaceViewRenderer take the value of
    // their scalingType properties into account upon their layouts.
    requestSurfaceViewRendererLayout();
}
Also used : SurfaceViewRenderer(org.webrtc.SurfaceViewRenderer)

Example 9 with SurfaceViewRenderer

use of org.webrtc.SurfaceViewRenderer in project matrix-android-sdk by matrix-org.

the class MXWebRtcView method tryAddRendererToVideoTrack.

/**
 * Starts rendering {@link #videoTrack} if rendering is not in progress and
 * all preconditions for the start of rendering are met.
 */
private void tryAddRendererToVideoTrack() {
    if (videoRenderer == null && videoTrack != null && ViewCompat.isAttachedToWindow(this)) {
        EglBase.Context sharedContext = EglUtils.getRootEglBaseContext();
        if (sharedContext == null) {
            // If SurfaceViewRenderer#init() is invoked, it will throw a
            // RuntimeException which will very likely kill the application.
            Log.e(LOG_TAG, "Failed to render a VideoTrack!");
            return;
        }
        SurfaceViewRenderer surfaceViewRenderer = getSurfaceViewRenderer();
        surfaceViewRenderer.init(sharedContext, rendererEvents);
        videoRenderer = new VideoRenderer(surfaceViewRenderer);
        videoTrack.addRenderer(videoRenderer);
    }
}
Also used : SurfaceViewRenderer(org.webrtc.SurfaceViewRenderer) VideoRenderer(org.webrtc.VideoRenderer) EglBase(org.webrtc.EglBase)

Aggregations

SurfaceViewRenderer (org.webrtc.SurfaceViewRenderer)9 View (android.view.View)3 TextView (android.widget.TextView)3 SharedPreferences (android.content.SharedPreferences)2 ScrollingMovementMethod (android.text.method.ScrollingMovementMethod)2 OnClickListener (android.view.View.OnClickListener)2 InputMethodManager (android.view.inputmethod.InputMethodManager)2 CompoundButton (android.widget.CompoundButton)2 RelativeLayout (android.widget.RelativeLayout)2 SeekBar (android.widget.SeekBar)2 Connection (com.flashphoner.fpwcsapi.bean.Connection)2 Data (com.flashphoner.fpwcsapi.bean.Data)2 PercentFrameLayout (com.flashphoner.fpwcsapi.layout.PercentFrameLayout)2 Message (com.flashphoner.fpwcsapi.room.Message)2 Participant (com.flashphoner.fpwcsapi.room.Participant)2 Room (com.flashphoner.fpwcsapi.room.Room)2 RoomEvent (com.flashphoner.fpwcsapi.room.RoomEvent)2 RoomManagerEvent (com.flashphoner.fpwcsapi.room.RoomManagerEvent)2 RoomManagerOptions (com.flashphoner.fpwcsapi.room.RoomManagerOptions)2 RoomOptions (com.flashphoner.fpwcsapi.room.RoomOptions)2