GenericCamera1

Created by Ernovation on 9/11/21.

Constructors

Link copied to clipboard
constructor(surfaceView: SurfaceView, connectChecker: ConnectChecker)
constructor(textureView: TextureView, connectChecker: ConnectChecker)
@RequiresApi(api = 18)
constructor(openGlView: OpenGlView, connectChecker: ConnectChecker)
@RequiresApi(api = 18)
constructor(context: Context, connectChecker: ConnectChecker)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun disableAudio()

Mute microphone, can be called before, while and after stream.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun disableLantern()
Link copied to clipboard
Link copied to clipboard
open fun enableAudio()

Enable a muted microphone, can be called before, while and after stream.

Link copied to clipboard
Link copied to clipboard
open fun enableFaceDetection(faceDetectorCallback: FaceDetectorCallback): Boolean
Link copied to clipboard
open fun enableLantern()
Link copied to clipboard
Link copied to clipboard
open fun forceCodecType(codecTypeVideo: CodecUtil.CodecType, codecTypeAudio: CodecUtil.CodecType)
Link copied to clipboard
open fun forceFpsLimit(enabled: Boolean)

Force stream to work with fps selected in prepareVideo method. Must be called before prepareVideo. This is not recommend because could produce fps problems.

Link copied to clipboard
open fun getBitrate(): Int
Link copied to clipboard
Link copied to clipboard
open fun getExposure(): Int
Link copied to clipboard
open fun getMaxExposure(): Int
Link copied to clipboard
open fun getMaxZoom(): Int

Return max zoom level

Link copied to clipboard
open fun getMinExposure(): Int
Link copied to clipboard
open fun getMinZoom(): Int

Return min zoom level

Link copied to clipboard
Link copied to clipboard

Get supported resolutions of back camera in px.

Link copied to clipboard

Get supported resolutions of front camera in px.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getStreamHeight(): Int
Link copied to clipboard
open fun getStreamWidth(): Int
Link copied to clipboard
Link copied to clipboard
open fun getZoom(): Float

Return current zoom level

Link copied to clipboard
open fun isAudioMuted(): Boolean

Get mute state of microphone.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Use getCameraFacing instead

Link copied to clipboard
Link copied to clipboard
open fun isRecording(): Boolean

Get record state.

Link copied to clipboard
Link copied to clipboard
open fun pauseRecord()
Link copied to clipboard
open fun prepareAudio(): Boolean

Same to call: prepareAudio(64 * 1024, 32000, true, false, false);

open fun prepareAudio(bitrate: Int, sampleRate: Int, isStereo: Boolean): Boolean
open fun prepareAudio(bitrate: Int, sampleRate: Int, isStereo: Boolean, echoCanceler: Boolean, noiseSuppressor: Boolean): Boolean

open fun prepareAudio(audioSource: Int, bitrate: Int, sampleRate: Int, isStereo: Boolean, echoCanceler: Boolean, noiseSuppressor: Boolean): Boolean

Call this method before use @startStream. If not you will do a stream without audio.

Link copied to clipboard
open fun prepareVideo(): Boolean

Same to call: rotation = 0; if (Portrait) rotation = 90; prepareVideo(640, 480, 30, 1200 * 1024, false, rotation);

open fun prepareVideo(width: Int, height: Int, bitrate: Int): Boolean
open fun prepareVideo(width: Int, height: Int, fps: Int, bitrate: Int, rotation: Int): Boolean

open fun prepareVideo(width: Int, height: Int, fps: Int, bitrate: Int, iFrameInterval: Int, rotation: Int): Boolean

backward compatibility reason

open fun prepareVideo(width: Int, height: Int, fps: Int, bitrate: Int, iFrameInterval: Int, rotation: Int, profile: Int, level: Int): Boolean

Call this method before use @startStream. If not you will do a stream without video. NOTE: Rotation with encoder is silence ignored in some devices.

Link copied to clipboard
@RequiresApi(api = 18)
open fun replaceView(context: Context)
@RequiresApi(api = 18)
open fun replaceView(openGlView: OpenGlView)
Link copied to clipboard
open fun requestKeyFrame()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun resumeRecord()
Link copied to clipboard
open fun setAudioCodec(codec: AudioCodec)
Link copied to clipboard
open fun setCameraCallbacks(callbacks: CameraCallbacks)
Link copied to clipboard
open fun setCustomAudioEffect(customAudioEffect: CustomAudioEffect)

Set an audio effect modifying microphone's PCM buffer.

Link copied to clipboard
open fun setEncoderErrorCallback(encoderErrorCallback: EncoderErrorCallback)

Set a callback to know errors related with Video/Audio encoders

Link copied to clipboard
open fun setExposure(value: Int)
Link copied to clipboard
Link copied to clipboard
open fun setMicrophoneMode(microphoneMode: MicrophoneMode)

Must be called before prepareAudio.

Link copied to clipboard
open fun setPreviewOrientation(orientation: Int)

Change preview orientation can be called while stream.

Link copied to clipboard
open fun setRecordController(recordController: BaseRecordController)
Link copied to clipboard
@RequiresApi(api = 19)
open fun setVideoBitrateOnFly(bitrate: Int)

Set video bitrate of H264 in bits per second while stream.

Link copied to clipboard
open fun setVideoCodec(codec: VideoCodec)
Link copied to clipboard
open fun setZoom(event: MotionEvent)

Set zoomIn or zoomOut to camera.

open fun setZoom(level: Int)

Set zoomIn or zoomOut to camera. Use this method if you use a zoom slider.

open fun setZoom(event: MotionEvent, delta: Int)
Link copied to clipboard
open fun startPreview()
open fun startPreview(cameraFacing: CameraHelper.Facing)
open fun startPreview(cameraFacing: Int)
open fun startPreview(cameraFacing: CameraHelper.Facing, rotation: Int)
open fun startPreview(width: Int, height: Int)
open fun startPreview(cameraFacing: CameraHelper.Facing, width: Int, height: Int)
open fun startPreview(cameraFacing: Int, width: Int, height: Int)
open fun startPreview(cameraFacing: CameraHelper.Facing, width: Int, height: Int, rotation: Int)
open fun startPreview(cameraFacing: Int, width: Int, height: Int, rotation: Int)

open fun startPreview(cameraFacing: CameraHelper.Facing, width: Int, height: Int, fps: Int, rotation: Int)
open fun startPreview(cameraId: Int, width: Int, height: Int, fps: Int, rotation: Int)

Start camera preview. Ignored, if stream or preview is started.

Link copied to clipboard
@RequiresApi(api = 26)
open fun startRecord(@NonNull fd: FileDescriptor)
@RequiresApi(api = 18)
open fun startRecord(@NonNull path: String)

@RequiresApi(api = 18)
open fun startRecord(@NonNull path: String, @Nullable listener: RecordController.Listener?)

Starts recording a MP4 video.

Link copied to clipboard
open fun startStream(url: String)

Need be called after @prepareVideo or/and @prepareAudio. This method override resolution of

Link copied to clipboard
@RequiresApi(api = 18)
open fun startStreamAndRecord(url: String, path: String)
@RequiresApi(api = 18)
open fun startStreamAndRecord(url: String, path: String, listener: RecordController.Listener)
Link copied to clipboard
open fun stopCamera()

Similar to stopPreview but you can do it while streaming or recording.

Link copied to clipboard
open fun stopPreview()

Stop camera preview. Ignored if streaming or already stopped. You need call it after

Link copied to clipboard
@RequiresApi(api = 18)
open fun stopRecord()

Stop record MP4 video started with @startRecord. If you don't call it file will be unreadable.

Link copied to clipboard
open fun stopStream()

Stop stream started with @startStream.

Link copied to clipboard
open fun switchCamera()

Switch camera used. Can be called anytime

open fun switchCamera(cameraId: Int)
Link copied to clipboard
open fun tapToFocus(view: View, event: MotionEvent): Boolean