org.webrtc.Camera1Enumerator Java Examples
The following examples show how to use
org.webrtc.Camera1Enumerator.
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: MainActivity.java From webrtc-android-tutorial with Apache License 2.0 | 6 votes |
private VideoCapturer createCameraCapturer(boolean isFront) { Camera1Enumerator enumerator = new Camera1Enumerator(false); final String[] deviceNames = enumerator.getDeviceNames(); // First, try to find front facing camera for (String deviceName : deviceNames) { if (isFront ? enumerator.isFrontFacing(deviceName) : enumerator.isBackFacing(deviceName)) { VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null); if (videoCapturer != null) { return videoCapturer; } } } return null; }
Example #2
Source File: MainActivity.java From webrtc-android-tutorial with Apache License 2.0 | 6 votes |
private VideoCapturer createCameraCapturer(boolean isFront) { Camera1Enumerator enumerator = new Camera1Enumerator(false); final String[] deviceNames = enumerator.getDeviceNames(); // First, try to find front facing camera for (String deviceName : deviceNames) { if (isFront ? enumerator.isFrontFacing(deviceName) : enumerator.isBackFacing(deviceName)) { VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null); if (videoCapturer != null) { return videoCapturer; } } } return null; }
Example #3
Source File: MainActivity.java From webrtc-android-tutorial with Apache License 2.0 | 6 votes |
private VideoCapturer createCameraCapturer(boolean isFront) { Camera1Enumerator enumerator = new Camera1Enumerator(false); final String[] deviceNames = enumerator.getDeviceNames(); // First, try to find front facing camera for (String deviceName : deviceNames) { if (isFront ? enumerator.isFrontFacing(deviceName) : enumerator.isBackFacing(deviceName)) { VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null); if (videoCapturer != null) { return videoCapturer; } } } return null; }
Example #4
Source File: WebRTCEngine.java From webrtc_android with MIT License | 6 votes |
/** * 创建媒体方式 * * @return VideoCapturer */ private VideoCapturer createVideoCapture() { VideoCapturer videoCapturer; if (screencaptureEnabled) { return createScreenCapturer(); } if (Camera2Enumerator.isSupported(mContext)) { videoCapturer = createCameraCapture(new Camera2Enumerator(mContext)); } else { videoCapturer = createCameraCapture(new Camera1Enumerator(true)); } return videoCapturer; }
Example #5
Source File: WebRTC.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
private void addVideoTrack(MediaStream mediaStream) { if (callTYpe == ProtoSignalingOffer.SignalingOffer.Type.VIDEO_CALLING) { videoCapturer = createCameraCapturer(new Camera1Enumerator(false)); videoSource = peerConnectionFactoryInstance().createVideoSource(videoCapturer); videoCapturer.startCapture(VIDEO_RESOLUTION_WIDTH, VIDEO_RESOLUTION_HEIGHT, FPS); videoTrackFromCamera = peerConnectionFactoryInstance().createVideoTrack(VIDEO_TRACK_ID, videoSource); videoTrackFromCamera.setEnabled(true); videoTrackFromCamera.addSink(new VideoSink() { @Override public void onFrame(VideoFrame videoFrame) { if (G.onVideoCallFrame != null) { G.onVideoCallFrame.onPeerFrame(videoFrame); } } }); mediaStream.addTrack(videoTrackFromCamera); } }
Example #6
Source File: OwtVideoCapturer.java From owt-client-android with Apache License 2.0 | 6 votes |
private static String getDeviceName(boolean captureToTexture, boolean isCameraFront) { CameraEnumerator enumerator = new Camera1Enumerator(captureToTexture); String deviceName = null; for (String device : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(device) && isCameraFront) { deviceName = device; break; } if (enumerator.isBackFacing(device) && !isCameraFront) { deviceName = device; break; } } return deviceName == null ? enumerator.getDeviceNames()[0] : deviceName; }
Example #7
Source File: WebRTCWrapper.java From Conversations with GNU General Public License v3.0 | 5 votes |
private CameraEnumerator getCameraEnumerator() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new Camera2Enumerator(requireContext()); } else { return new Camera1Enumerator(); } }
Example #8
Source File: Camera.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private @NonNull CameraEnumerator getCameraEnumerator(@NonNull Context context) { boolean camera2EnumeratorIsSupported = false; try { camera2EnumeratorIsSupported = Camera2Enumerator.isSupported(context); } catch (final Throwable throwable) { Log.w(TAG, "Camera2Enumator.isSupport() threw.", throwable); } Log.i(TAG, "Camera2 enumerator supported: " + camera2EnumeratorIsSupported); return camera2EnumeratorIsSupported ? new FilteredCamera2Enumerator(context) : new Camera1Enumerator(true); }
Example #9
Source File: WebRTCWrapper.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
private CameraEnumerator getCameraEnumerator() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new Camera2Enumerator(requireContext()); } else { return new Camera1Enumerator(); } }
Example #10
Source File: MainActivity.java From janus-gateway-android with MIT License | 5 votes |
private VideoCapturer createVideoCapturer() { VideoCapturer videoCapturer = null; if (useCamera2()) { Log.d(TAG, "Creating capturer using camera2 API."); videoCapturer = createCameraCapturer(new Camera2Enumerator(this)); } else { Log.d(TAG, "Creating capturer using camera1 API."); videoCapturer = createCameraCapturer(new Camera1Enumerator(captureToTexture())); } if (videoCapturer == null) { Log.e(TAG, "Failed to open camera"); return null; } return videoCapturer; }
Example #11
Source File: RTCCall.java From Meshenger with GNU General Public License v3.0 | 5 votes |
private CameraVideoCapturer createCapturer() { CameraEnumerator enumerator = new Camera1Enumerator(); for (String name : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(name)) { return enumerator.createCapturer(name, null); } } return null; }
Example #12
Source File: VideoCapturerForTest.java From owt-client-android with Apache License 2.0 | 5 votes |
private static String getDeviceName(boolean captureToTexture) { CameraEnumerator enumerator = new Camera1Enumerator(captureToTexture); String deviceName = null; for (String device : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(device)) { deviceName = device; break; } } return deviceName == null ? enumerator.getDeviceNames()[0] : deviceName; }
Example #13
Source File: CallActivity.java From RTCStartupDemo with GNU General Public License v3.0 | 5 votes |
private VideoCapturer createVideoCapturer() { if (Camera2Enumerator.isSupported(this)) { return createCameraCapturer(new Camera2Enumerator(this)); } else { return createCameraCapturer(new Camera1Enumerator(true)); } }
Example #14
Source File: PeerConnectionWrapper.java From bcm-android with GNU General Public License v3.0 | 5 votes |
private @NonNull CameraEnumerator getCameraEnumerator(@NonNull Context context) { boolean camera2EnumeratorIsSupported = false; try { camera2EnumeratorIsSupported = Camera2Enumerator.isSupported(context); } catch (final Throwable throwable) { ALog.w(TAG, "Camera2Enumator.isSupport() threw. " + throwable.getMessage()); } ALog.i(TAG, "Camera2 enumerator supported: " + camera2EnumeratorIsSupported); return camera2EnumeratorIsSupported ? new Camera2Enumerator(context) : new Camera1Enumerator(true); }
Example #15
Source File: RTCCall.java From meshenger-android with GNU General Public License v3.0 | 5 votes |
private CameraVideoCapturer createCapturer() { CameraEnumerator enumerator = new Camera1Enumerator(); for (String name : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(name)) { return enumerator.createCapturer(name, null); } } return null; }
Example #16
Source File: PeersManager.java From WebRTCapp with Apache License 2.0 | 4 votes |
private VideoCapturer createVideoGrabber() { VideoCapturer videoCapturer; videoCapturer = createCameraGrabber(new Camera1Enumerator(false)); return videoCapturer; }
Example #17
Source File: VideoCapturers.java From VideoCRE with MIT License | 4 votes |
public static VideoCapturer createCamera1Capturer(boolean captureToTexture) { return createCameraCapturer(new Camera1Enumerator(captureToTexture)); }