# RtmpStreamClient

class RtmpStreamClient(rtmpClient: RtmpClient, streamClientListener: StreamClientListener?) : StreamBaseClient

Created by pedro on 12/10/23.

## Constructors

RtmpStreamClient
Link copied to clipboard
constructor(rtmpClient: RtmpClient, streamClientListener: StreamClientListener?)

## Functions

addCertificates
Link copied to clipboard
fun addCertificates(certificates: TrustManager?)

Add certificates for TLS connection

clearCache
Link copied to clipboard
open override fun clearCache()
forceIncrementalTs
Link copied to clipboard
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. Necessary with Servers like Dacast. More info here: https://learn.akamai.com/en-us/webhelp/media-services-live/media-services-live-encoder-compatibility-testing-and-qualification-guide-v4.0/GUID-F941C88B-9128-4BF4-A81B-C2E5CFD35BBF.html

getBitrateExponentialFactor
Link copied to clipboard
open override fun getBitrateExponentialFactor(): Float

Get the exponential factor used to calculate the bitrate. Default 1f

getBytesSend
Link copied to clipboard
open override fun getBytesSend(): Long
getCacheSize
Link copied to clipboard
open override fun getCacheSize(): Int
getDroppedAudioFrames
Link copied to clipboard
open override fun getDroppedAudioFrames(): Long
getDroppedVideoFrames
Link copied to clipboard
open override fun getDroppedVideoFrames(): Long
getItemsInCache
Link copied to clipboard
open override fun getItemsInCache(): Int
getRtt
Link copied to clipboard
fun getRtt(): Int

RTT in micro seconds reported by ping-pong commands. shouldSendPings must be enabled to work properly.

getSentAudioFrames
Link copied to clipboard
open override fun getSentAudioFrames(): Long
getSentVideoFrames
Link copied to clipboard
open override fun getSentVideoFrames(): Long
hasCongestion
Link copied to clipboard
open override fun hasCongestion(percentUsed: Float): Boolean
fun hasCongestion(): Boolean
resetBytesSend
Link copied to clipboard
open override fun resetBytesSend()
resetDroppedAudioFrames
Link copied to clipboard
open override fun resetDroppedAudioFrames()
resetDroppedVideoFrames
Link copied to clipboard
open override fun resetDroppedVideoFrames()
resetSentAudioFrames
Link copied to clipboard
open override fun resetSentAudioFrames()
resetSentVideoFrames
Link copied to clipboard
open override fun resetSentVideoFrames()
resizeCache
Link copied to clipboard
open override fun resizeCache(newSize: Int)
reTry
Link copied to clipboard
open override fun reTry(delay: Long, reason: String, backupUrl: String?): Boolean

Retries to connect with the given delay. You can pass an optional backupUrl if you'd like to connect to your backup server instead of the original one. Given backupUrl replaces the original one.

fun reTry(delay: Long, reason: String): Boolean
setAuthorization
Link copied to clipboard
open override fun setAuthorization(user: String?, password: String?)
setBitrateExponentialFactor
Link copied to clipboard
open override fun setBitrateExponentialFactor(factor: Float)
setCheckServerAlive
Link copied to clipboard
open override fun setCheckServerAlive(enabled: Boolean)
setCustomAmfObject
Link copied to clipboard
fun setCustomAmfObject(amfObject: Map<String, Any>)
setDelay
Link copied to clipboard
open override fun setDelay(millis: Long)

Set stream delay in millis. This will create a cache and wait the delay to start send packets in real time

setFlashVersion
Link copied to clipboard
fun setFlashVersion(flashVersion: String)

Must be called before start stream or will be ignored.

setIgnoredCommandCallback
Link copied to clipboard
fun setIgnoredCommandCallback(callback: (String) -> Unit?)
setLogs
Link copied to clipboard
open override fun setLogs(enabled: Boolean)
setOnlyAudio
Link copied to clipboard
open override fun setOnlyAudio(onlyAudio: Boolean)
setOnlyVideo
Link copied to clipboard
open override fun setOnlyVideo(onlyVideo: Boolean)
setReTries
Link copied to clipboard
open override fun setReTries(reTries: Int)
setSocketTimeout
Link copied to clipboard
open override fun setSocketTimeout(timeout: Long)

Set timeout ms for connection, write and read in sockets by default 5000ms

setSocketType
Link copied to clipboard
open override fun setSocketType(type: SocketType)

Set if you want use java.io or ktor socket

setWriteChunkSize
Link copied to clipboard
fun setWriteChunkSize(chunkSize: Int)

Must be called before start stream or will be ignored.

shouldFailOnRead
Link copied to clipboard
fun shouldFailOnRead(enabled: Boolean)

Should notify onConnectionFailed if read packet from the server failed

shouldSendPings
Link copied to clipboard
fun shouldSendPings(enabled: Boolean)

Send ping commands each second to server. This allow get a RTT and keep alive the read channel in servers that close it due to inactivity.