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));
}
}
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);
}
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);
}
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));
}
}
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);
}
Aggregations