// 获取默认预设值
val preOpt: PreOptionCamera = PreOptionCamera.get_1080P()
// 修改采集配置中的摄像头位置
preOpt.capture.position = CameraCaptureOptions.CamraPosition.BACK
// 修改发布配置中的编码格式
preOpt.publish.codec = CodecType.H265
// 使用修改后的预设值
...
```kotlin
### PreOptionCamera.def
配置如下:
```kotlin
val _1080P: PreOptionCamera = PreOptionCamera(
CameraCaptureOptions(
deviceId = "cameraCapMain",
position = CameraCaptureOptions.CamraPosition.FRONT,
facingMode = CameraCaptureOptions.CameraFacingMode.USER,
width = 1920,
height = 1080,
maxFps = 30
),
VideoPublishOptions(
desc = TrackDesc.TRACK_MAIN.value,
codec = CodecType.H264,
maxBitrate = 2000 * 1024,
width = 1920,
height = 1080,
maxFps = 25,
props = null,
simulcasts = mutableListOf(
VideoPublishOptions(
desc = TrackDesc.TRACK_SUB.value,
codec = CodecType.H264,
maxBitrate = 128 * 1024,
width = 320,
height = 180,
maxFps = 25,
props = null,
simulcasts = null
)
)
)
)
val _720P: PreOptionCamera = PreOptionCamera(
CameraCaptureOptions(
deviceId = "cameraCapMain",
position = CameraCaptureOptions.CamraPosition.FRONT,
facingMode = CameraCaptureOptions.CameraFacingMode.USER,
width = 1280,
height = 720,
maxFps = 30
),
VideoPublishOptions(
desc = TrackDesc.TRACK_MAIN.value,
codec = CodecType.H264,
maxBitrate = 900 * 1024,
width = 1280,
height = 720,
maxFps = 25,
props = null,
simulcasts = mutableListOf(
VideoPublishOptions(
desc = TrackDesc.TRACK_SUB.value,
codec = CodecType.H264,
maxBitrate = 128 * 1024,
width = 320,
height = 180,
maxFps = 25,
props = null,
simulcasts = null
)
)
)
)
val _480P: PreOptionCamera = PreOptionCamera(
CameraCaptureOptions(
deviceId = "cameraCapMain",
position = CameraCaptureOptions.CamraPosition.FRONT,
facingMode = CameraCaptureOptions.CameraFacingMode.USER,
width = 640,
height = 480,
maxFps = 30
),
VideoPublishOptions(
desc = TrackDesc.TRACK_MAIN.value,
codec = CodecType.H264,
maxBitrate = 512 * 1024,
width = 640,
height = 480,
maxFps = 25,
props = null,
simulcasts = mutableListOf(
VideoPublishOptions(
desc = TrackDesc.TRACK_SUB.value,
codec = CodecType.H264,
maxBitrate = 128 * 1024,
width = 320,
height = 180,
maxFps = 25,
props = null,
simulcasts = null
)
)
)
)
val _180P: PreOptionCamera = PreOptionCamera(
CameraCaptureOptions(
deviceId = "cameraCapMain",
position = CameraCaptureOptions.CamraPosition.FRONT,
facingMode = CameraCaptureOptions.CameraFacingMode.USER,
width = 320,
height = 180,
maxFps = 30
),
VideoPublishOptions(
desc = TrackDesc.TRACK_MAIN.value,
codec = CodecType.H264,
maxBitrate = 128 * 1024,
width = 320,
height = 180,
maxFps = 25,
props = null,
simulcasts = mutableListOf(
VideoPublishOptions(
desc = TrackDesc.TRACK_SUB.value,
codec = CodecType.H264,
maxBitrate = 128 * 1024,
width = 320,
height = 180,
maxFps = 25,
props = null,
simulcasts = null
)
)
)
)