Search in sources :

Example 1 with CapturerObserver

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

the class WebRtcVideoUtil method initializeVanityCamera.

@NonNull
public static WebRtcServiceState initializeVanityCamera(@NonNull WebRtcServiceState currentState) {
    Camera camera = currentState.getVideoState().requireCamera();
    VideoSink sink = currentState.getVideoState().requireLocalSink();
    if (camera.hasCapturer()) {
        camera.initCapturer(new CapturerObserver() {

            @Override
            public void onFrameCaptured(VideoFrame videoFrame) {
                sink.onFrame(videoFrame);
            }

            @Override
            public void onCapturerStarted(boolean success) {
            }

            @Override
            public void onCapturerStopped() {
            }
        });
        camera.setEnabled(true);
    }
    return currentState.builder().changeLocalDeviceState().cameraState(camera.getCameraState()).build();
}
Also used : VideoFrame(org.webrtc.VideoFrame) CapturerObserver(org.webrtc.CapturerObserver) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) VideoSink(org.webrtc.VideoSink) Camera(org.thoughtcrime.securesms.ringrtc.Camera) NonNull(androidx.annotation.NonNull)

Example 2 with CapturerObserver

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

the class WebRtcVideoUtil method initializeVanityCamera.

@NonNull
public static WebRtcServiceState initializeVanityCamera(@NonNull WebRtcServiceState currentState) {
    Camera camera = currentState.getVideoState().requireCamera();
    VideoSink sink = currentState.getVideoState().requireLocalSink();
    if (camera.hasCapturer()) {
        camera.initCapturer(new CapturerObserver() {

            @Override
            public void onFrameCaptured(VideoFrame videoFrame) {
                sink.onFrame(videoFrame);
            }

            @Override
            public void onCapturerStarted(boolean success) {
            }

            @Override
            public void onCapturerStopped() {
            }
        });
        camera.setEnabled(true);
    }
    return currentState.builder().changeLocalDeviceState().cameraState(camera.getCameraState()).build();
}
Also used : VideoFrame(org.webrtc.VideoFrame) CapturerObserver(org.webrtc.CapturerObserver) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) VideoSink(org.webrtc.VideoSink) Camera(org.thoughtcrime.securesms.ringrtc.Camera) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)2 BroadcastVideoSink (org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink)2 Camera (org.thoughtcrime.securesms.ringrtc.Camera)2 CapturerObserver (org.webrtc.CapturerObserver)2 VideoFrame (org.webrtc.VideoFrame)2 VideoSink (org.webrtc.VideoSink)2