MultiRtpDisplay

Created by pedro, HirogaKatageri on 2021-05-24. Experimental Class. It supports multiple streams of rtmp and rtsp at same time. You must set the same number of ConnectChecker that you want use. For example. 2 RTMP and 1 RTSP: stream1, stream2, stream3 (stream1 and stream2 are ConnectCheckerRtmp. stream3 is ConnectCheckerRtsp) MultiRtpDisplay multiRtpDisplay = new MultiRtpDisplay(context, true, new ConnectCheckerRtmp[]{ stream1, stream2 }, new ConnectCheckerRtsp[]{ stream3 }); You can set an empty array or null if you don't want to use a specific protocol. new MultiRtpDisplay(context, true, new ConnectCheckerRtmp[]{ stream1, stream2 }, null); // RTSP protocol is not used In order to use start, stop and other calls you must send type of stream and index to execute it. Example (using previous example interfaces): multiRtpDisplay.startStream(RtpType.RTMP, 1, url); //stream2 is started multiRtpDisplay.stopStream(RtpType.RTSP, 0); //stream3 is stopped multiRtpDisplay.retry(RtpType.RTMP, 0, delay, reason, backupUrl) //retry stream1 NOTE: If you call these methods nothing is executed: multiRtpDisplay.startStream(endpoint); multiRtpDisplay.stopStream(); multiRtpDisplay.retry(delay, reason, backUpUrl); The rest of methods without RtpType and index means that you will execute that command in all streams. Read class code if you need info about any method.

Constructors

Link copied to clipboard
constructor(context: Context, useOpenGL: Boolean, connectCheckerRtmpList: Array<ConnectChecker>, connectCheckerRtspList: Array<ConnectChecker>)

Properties

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
open fun enableAudio()
Enable a muted microphone, can be called before, while and after stream.
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.
Link copied to clipboard
open fun forceIncrementalTs(enabled: Boolean)
Some Livestream hosts use Akamai auth that requires RTMP packets to be sent with increasing timestamp order regardless of packet type.
Link copied to clipboard
open fun getBitrate(): Int
Link copied to clipboard
open fun getCacheSize(multiType: RtpType, index: Int): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
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
open fun hasCongestion(multiType: RtpType, index: Int): Boolean
Link copied to clipboard
open fun isAudioMuted(): Boolean
Get mute state of microphone.
Link copied to clipboard
open fun isRecording(): Boolean
Get record state.
Link copied to clipboard
open fun isStreaming(): Boolean
Get stream state.
open fun isStreaming(multiType: RtpType, index: Int): Boolean
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.
Link copied to clipboard
open fun prepareInternalAudio(bitrate: Int, sampleRate: Int, isStereo: Boolean): Boolean

open fun prepareInternalAudio(bitrate: Int, sampleRate: Int, isStereo: Boolean, echoCanceler: Boolean, noiseSuppressor: Boolean): Boolean
Call this method before use @startStream for streaming internal audio only.
Link copied to clipboard
open fun prepareVideo(): Boolean
Same to call: rotation = 0; if (Portrait) rotation = 90; prepareVideo(640, 480, 30, 1200 * 1024, true, 0);
open fun prepareVideo(width: Int, height: Int, bitrate: Int): Boolean
open fun prepareVideo(width: Int, height: Int, fps: Int, bitrate: Int, rotation: Int, dpi: Int): Boolean

open fun prepareVideo(width: Int, height: Int, fps: Int, bitrate: Int, rotation: Int, dpi: Int, profile: Int, level: Int, iFrameInterval: Int): Boolean
Call this method before use @startStream.
Link copied to clipboard
open fun requestKeyFrame()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun resizeCache(multiType: RtpType, index: Int, newSize: Int)
Link copied to clipboard
open fun resumeRecord()
Link copied to clipboard
open fun reTry(multiType: RtpType, index: Int, delay: Long, reason: String, @Nullable backupUrl: String): Boolean
Link copied to clipboard
open fun sendIntent(): Intent
Create Intent used to init screen capture with startActivityForResult.
Link copied to clipboard
open fun setAudioCodec(codec: AudioCodec)
Link copied to clipboard
open fun setAudioMaxInputSize(size: Int)
Set a custom size of audio buffer input.
Link copied to clipboard
open fun setAuthorization(user: String, password: String)
open fun setAuthorization(multiType: RtpType, index: Int, user: String, password: String)
Link copied to clipboard
open fun setCheckServerAlive(enable: Boolean)
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
Link copied to clipboard
open fun setIntentResult(resultCode: Int, data: Intent)
Link copied to clipboard
open fun setLogs(enable: Boolean)
Link copied to clipboard
open fun setMediaProjectionCallback(mediaProjectionCallback: MediaProjection.Callback)
Link copied to clipboard
open fun setMicrophoneMode(microphoneMode: MicrophoneMode)
Must be called before prepareAudio.
Link copied to clipboard
open fun setRecordController(recordController: BaseRecordController)
Link copied to clipboard
open fun setReTries(reTries: Int)
Link copied to clipboard
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
Link copied to clipboard
open fun startStream(url: String)
Need be called after @prepareVideo or/and @prepareAudio.
open fun startStream(multiType: RtpType, index: Int, url: String)
Link copied to clipboard
open fun stopRecord()
Stop record MP4 video started with @startRecord.
Link copied to clipboard
open fun stopStream()
Stop stream started with @startStream.
open fun stopStream(multiType: RtpType, index: Int)