Search in sources :

Example 1 with VideoTrack

use of org.webrtc.VideoTrack in project Signal-Android by signalapp.

the class WebRtcCallService method onAddStream.

@Override
public void onAddStream(MediaStream stream) {
    Log.w(TAG, "onAddStream:" + stream);
    for (AudioTrack audioTrack : stream.audioTracks) {
        audioTrack.setEnabled(true);
    }
    if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
        VideoTrack videoTrack = stream.videoTracks.get(0);
        videoTrack.setEnabled(true);
        videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
    }
}
Also used : VideoRenderer(org.webrtc.VideoRenderer) VideoTrack(org.webrtc.VideoTrack) AudioTrack(org.webrtc.AudioTrack)

Example 2 with VideoTrack

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

the class MXWebRtcView method setStream.

/**
 * Sets the {@code MediaStream} to be rendered by this {@code WebRTCView}.
 * The implementation renders the first {@link VideoTrack}, if any, of the
 * specified {@code mediaStream}.
 *
 * @param mediaStream The {@code MediaStream} to be rendered by this
 *                    {@code WebRTCView} or {@code null}.
 */
public void setStream(MediaStream mediaStream) {
    VideoTrack videoTrack;
    if (mediaStream == null) {
        videoTrack = null;
    } else {
        List<VideoTrack> videoTracks = mediaStream.videoTracks;
        videoTrack = videoTracks.isEmpty() ? null : videoTracks.get(0);
    }
    setVideoTrack(videoTrack);
}
Also used : VideoTrack(org.webrtc.VideoTrack)

Example 3 with VideoTrack

use of org.webrtc.VideoTrack in project Conversations by siacs.

the class WebRTCWrapper method setVideoEnabled.

void setVideoEnabled(final boolean enabled) {
    final VideoTrack videoTrack = this.localVideoTrack;
    if (videoTrack == null) {
        throw new IllegalStateException("Local video track does not exist");
    }
    videoTrack.setEnabled(enabled);
}
Also used : VideoTrack(org.webrtc.VideoTrack)

Example 4 with VideoTrack

use of org.webrtc.VideoTrack in project Signal-Android by WhisperSystems.

the class WebRtcCallService method onAddStream.

@Override
public void onAddStream(MediaStream stream) {
    Log.w(TAG, "onAddStream:" + stream);
    for (AudioTrack audioTrack : stream.audioTracks) {
        audioTrack.setEnabled(true);
    }
    if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
        VideoTrack videoTrack = stream.videoTracks.getFirst();
        videoTrack.setEnabled(true);
        videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
    }
}
Also used : VideoRenderer(org.webrtc.VideoRenderer) VideoTrack(org.webrtc.VideoTrack) AudioTrack(org.webrtc.AudioTrack)

Example 5 with VideoTrack

use of org.webrtc.VideoTrack 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)

Aggregations

VideoTrack (org.webrtc.VideoTrack)7 VideoRenderer (org.webrtc.VideoRenderer)4 AudioTrack (org.webrtc.AudioTrack)2 RelativeLayout (android.widget.RelativeLayout)1 NonNull (androidx.annotation.NonNull)1 AndroidVideoTrack (im.actor.runtime.android.webrtc.AndroidVideoTrack)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 GroupCall (org.signal.ringrtc.GroupCall)1 BroadcastVideoSink (org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink)1 CallParticipant (org.thoughtcrime.securesms.events.CallParticipant)1 CallParticipantId (org.thoughtcrime.securesms.events.CallParticipantId)1 Recipient (org.thoughtcrime.securesms.recipients.Recipient)1 WebRtcServiceStateBuilder (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder)1 SurfaceViewRenderer (org.webrtc.SurfaceViewRenderer)1