|
|
@ -21,7 +21,7 @@ allprojects { |
|
|
|
Step 2. Add the dependency |
|
|
|
```java |
|
|
|
dependencies { |
|
|
|
implementation 'com.github.jiangdongguo:AndroidUSBCamera:2.1.0' |
|
|
|
implementation 'com.github.jiangdongguo:AndroidUSBCamera:2.2.8' |
|
|
|
} |
|
|
|
``` |
|
|
|
### 2. APIs Introduction |
|
|
@ -33,7 +33,7 @@ mCameraHelper = UVCCameraHelper.getInstance(); |
|
|
|
// set default preview size |
|
|
|
mCameraHelper.setDefaultPreviewSize(1280,720); |
|
|
|
// set default frame format,defalut is UVCCameraHelper.Frame_FORMAT_MPEG |
|
|
|
// if using mpeg can not record mp4,please try yuv(version 2.1.0 do not support) |
|
|
|
// if using mpeg can not record mp4,please try yuv |
|
|
|
// mCameraHelper.setDefaultFrameFormat(UVCCameraHelper.FRAME_FORMAT_YUYV); |
|
|
|
mCameraHelper.initUSBMonitor(this, mUVCCameraView, mDevConnectListener); |
|
|
|
``` |
|
|
@ -113,7 +113,7 @@ RecordParams params = new RecordParams(); |
|
|
|
params.setRecordPath(videoPath); |
|
|
|
params.setRecordDuration(0); // 0,do not cut save |
|
|
|
params.setVoiceClose(mSwitchVoice.isChecked()); // is close voice |
|
|
|
mCameraHelper.startRecording(params, new AbstractUVCCameraHandler.OnEncodeResultListener() { |
|
|
|
mCameraHelper.startPusher(params, new AbstractUVCCameraHandler.OnEncodeResultListener() { |
|
|
|
@Override |
|
|
|
public void onEncodeResult(byte[] data, int offset, int length, long timestamp, int type) { |
|
|
|
// type = 1,h264 video stream |
|
|
@ -131,6 +131,9 @@ RecordParams params = new RecordParams(); |
|
|
|
Log.i(TAG,"videoPath = "+videoPath); |
|
|
|
} |
|
|
|
}); |
|
|
|
// of course,if you only want to getting h.264 and aac stream |
|
|
|
// you can do like this |
|
|
|
mCameraHelper.startPusher(listener); |
|
|
|
``` |
|
|
|
(4) setting camera's brightness and contrast. |
|
|
|
```java |
|
|
|