prepareVideo

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.

Return

true if success, false if you get a error (Normally because the encoder selected doesn't support any configuration seated or your device hasn't a H264 encoder).

Parameters

width

resolution in px.

height

resolution in px.

fps

frames per second of the stream.

bitrate

H264 in bps.

rotation

could be 90, 180, 270 or 0. You should use CameraHelper.getCameraOrientation

profile

codec value from MediaCodecInfo.CodecProfileLevel class

level

codec value from MediaCodecInfo.CodecProfileLevel class with SurfaceView or TextureView and 0 with OpenGlView or LightOpenGlView. NOTE: Rotation with encoder is silence ignored in some devices.


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, rotation: Int): Boolean
open fun prepareVideo(width: Int, height: Int, bitrate: Int): Boolean


open fun prepareVideo(): Boolean

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

Return

true if success, false if you get a error (Normally because the encoder selected doesn't support any configuration seated or your device hasn't a H264 encoder).