# FromFileBase

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
abstract class FromFileBase

Wrapper to stream a MP4 file with H264 video codec. Only Video is streamed, no Audio. Can be executed in background. API requirements: API 18+. Created by pedro on 7/07/17.

#### Inheritors

GenericFromFile
MultiFromFile
RtmpFromFile
RtspFromFile
SrtFromFile
UdpFromFile

## Constructors

FromFileBase
Link copied to clipboard
constructor(videoDecoderInterface: VideoDecoderInterface, audioDecoderInterface: AudioDecoderInterface)
constructor(context: Context, videoDecoderInterface: VideoDecoderInterface, audioDecoderInterface: AudioDecoderInterface)
OpenGl mode, necessary context.
constructor(openGlView: OpenGlView, videoDecoderInterface: VideoDecoderInterface, audioDecoderInterface: AudioDecoderInterface)

## Properties

glInterface
Link copied to clipboard
open val glInterface: GlInterface

## Functions

forceBt709Color
Link copied to clipboard
open fun forceBt709Color(enabled: Boolean)
forceCodecType
Link copied to clipboard
open fun forceCodecType(codecTypeVideo: CodecUtil.CodecType, codecTypeAudio: CodecUtil.CodecType)
forceFpsLimit
Link copied to clipboard
open fun forceFpsLimit(enabled: Boolean)
Force stream to work with fps selected in prepareVideo method.
getAudioDuration
Link copied to clipboard
open fun getAudioDuration(): Double
getAudioTime
Link copied to clipboard
open fun getAudioTime(): Double
getBitrate
Link copied to clipboard
open fun getBitrate(): Int
getRecordStatus
Link copied to clipboard
open fun getRecordStatus(): RecordController.Status
getResolutionValue
Link copied to clipboard
open fun getResolutionValue(): Int
getStreamClient
Link copied to clipboard
abstract fun getStreamClient(): StreamBaseClient
getStreamHeight
Link copied to clipboard
open fun getStreamHeight(): Int
getStreamWidth
Link copied to clipboard
open fun getStreamWidth(): Int
getVideoDuration
Link copied to clipboard
open fun getVideoDuration(): Double
getVideoTime
Link copied to clipboard
open fun getVideoTime(): Double
isAudioDeviceEnabled
Link copied to clipboard
open fun isAudioDeviceEnabled(): Boolean
isRecording
Link copied to clipboard
open fun isRecording(): Boolean
Get record state.
isStreaming
Link copied to clipboard
open fun isStreaming(): Boolean
Get stream state.
moveTo
Link copied to clipboard
open fun moveTo(time: Double)
Working but it is too slow.
pauseRecord
Link copied to clipboard
open fun pauseRecord()
playAudioDevice
Link copied to clipboard
open fun playAudioDevice()
prepareAudio
Link copied to clipboard
open fun prepareAudio(filePath: String): Boolean
open fun prepareAudio(context: Context, uri: Uri): Boolean
open fun prepareAudio(fileDescriptor: FileDescriptor, bitRate: Int): Boolean
open fun prepareAudio(filePath: String, bitRate: Int): Boolean
open fun prepareAudio(context: Context, uri: Uri, bitRate: Int): Boolean
prepareVideo
Link copied to clipboard
open fun prepareVideo(fileDescriptor: FileDescriptor): Boolean
open fun prepareVideo(filePath: String): Boolean
open fun prepareVideo(context: Context, uri: Uri): Boolean
open fun prepareVideo(fileDescriptor: FileDescriptor, bitRate: Int, rotation: Int): Boolean
open fun prepareVideo(filePath: String, bitRate: Int, rotation: Int): Boolean
open fun prepareVideo(context: Context, uri: Uri, bitRate: Int, rotation: Int): Boolean
open fun prepareVideo(fileDescriptor: FileDescriptor, bitRate: Int, rotation: Int, profile: Int, level: Int): Boolean
open fun prepareVideo(filePath: String, bitRate: Int, rotation: Int, profile: Int, level: Int): Boolean
open fun prepareVideo(context: Context, uri: Uri, bitRate: Int, rotation: Int, profile: Int, level: Int): Boolean
replaceAudioFile
Link copied to clipboard
open fun replaceAudioFile(fileDescriptor: FileDescriptor)
open fun replaceAudioFile(filePath: String)
open fun replaceAudioFile(context: Context, uri: Uri)
replaceVideoFile
Link copied to clipboard
open fun replaceVideoFile(fileDescriptor: FileDescriptor)
open fun replaceVideoFile(filePath: String)
open fun replaceVideoFile(context: Context, uri: Uri)
replaceView
Link copied to clipboard
open fun replaceView(context: Context)
open fun replaceView(openGlView: OpenGlView)
requestKeyFrame
Link copied to clipboard
open fun requestKeyFrame()
resetAudioEncoder
Link copied to clipboard
open fun resetAudioEncoder(): Boolean
resetVideoEncoder
Link copied to clipboard
open fun resetVideoEncoder(): Boolean
resumeRecord
Link copied to clipboard
open fun resumeRecord()
reSyncFile
Link copied to clipboard
open fun reSyncFile()
setAudioCodec
Link copied to clipboard
open fun setAudioCodec(codec: AudioCodec)
setAudioExtractor
Link copied to clipboard
open fun setAudioExtractor(extractor: Extractor)
setDecoderErrorCallback
Link copied to clipboard
open fun setDecoderErrorCallback(codecErrorCallback: CodecErrorCallback)
setEncoderErrorCallback
Link copied to clipboard
open fun setEncoderErrorCallback(encoderErrorCallback: CodecErrorCallback)
Set a callback to know errors related with Video/Audio encoders
setFpsListener
Link copied to clipboard
open fun setFpsListener(callback: FpsListener.Callback)
setLoopMode
Link copied to clipboard
open fun setLoopMode(loopMode: Boolean)
If you want reproduce video in loop.
setRecordController
Link copied to clipboard
open fun setRecordController(recordController: RecordController)
setTimestampMode
Link copied to clipboard
open fun setTimestampMode(timestampModeVideo: TimestampMode, timestampModeAudio: TimestampMode)
Set the mode to calculate timestamp.
setVideoBitrateOnFly
Link copied to clipboard
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
open fun setVideoBitrateOnFly(bitrate: Int)
Set video bitrate of H264 in bits per second while stream.
setVideoCodec
Link copied to clipboard
open fun setVideoCodec(codec: VideoCodec)
setVideoExtractor
Link copied to clipboard
open fun setVideoExtractor(extractor: Extractor)
startRecord
Link copied to clipboard
@RequiresApi(api = Build.VERSION_CODES.O)
open fun startRecord(@NonNull fd: FileDescriptor)
open fun startRecord(@NonNull path: String)
@RequiresApi(api = Build.VERSION_CODES.O)
open fun startRecord(@NonNull fd: FileDescriptor, @Nullable listener: RecordController.Listener)
open fun startRecord(@NonNull path: String, @Nullable listener: RecordController.Listener)
Starts recording a MP4 video.
startStream
Link copied to clipboard
open fun startStream(url: String)
Need be called after @prepareVideo.
stopAudioDevice
Link copied to clipboard
open fun stopAudioDevice()
stopRecord
Link copied to clipboard
open fun stopRecord()
Stop record MP4 video started with @startRecord.
stopStream
Link copied to clipboard
open fun stopStream()
Stop stream started with @startStream.