Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import android.content.Context
import io.github.komedia.komuxer.flv.tags.FLVTag
import io.github.komedia.komuxer.rtmp.RtmpConnectionBuilder
import io.github.komedia.komuxer.rtmp.client.RtmpClient
import io.github.komedia.komuxer.rtmp.client.RtmpClientSettings
import io.github.komedia.komuxer.rtmp.connect
import io.github.komedia.komuxer.rtmp.messages.command.StreamPublishType
import io.github.thibaultbee.streampack.core.configuration.mediadescriptor.MediaDescriptor
Expand Down Expand Up @@ -56,7 +57,9 @@ import java.io.IOException
* An endpoint that send frame to an RTMP server.
*/
class RtmpEndpoint internal constructor(
defaultDispatcher: CoroutineDispatcher, val ioDispatcher: CoroutineDispatcher
defaultDispatcher: CoroutineDispatcher,
val ioDispatcher: CoroutineDispatcher,
private val clientSettings: RtmpClientSettings = RtmpClientSettings()
) : IEndpointInternal {
private val coroutineScope = CoroutineScope(SupervisorJob() + defaultDispatcher)
private val mutex = Mutex()
Expand Down Expand Up @@ -109,7 +112,7 @@ class RtmpEndpoint internal constructor(
return@withContext
}

rtmpClient = connectionBuilder.connect(descriptor.uri.toString()).apply {
rtmpClient = connectionBuilder.connect(descriptor.uri.toString(), settings = clientSettings).apply {
_isOpenFlow.emit(true)

socketContext.invokeOnCompletion { throwable ->
Expand Down Expand Up @@ -236,9 +239,17 @@ class RtmpEndpoint internal constructor(

/**
* A factory to build a [RtmpEndpoint].
*
* @param clientSettings optional [RtmpClientSettings] forwarded to every
* endpoint created by this factory. Use the [RtmpClientSettings.connectInfo]
* lambda to customise the RTMP connect command — for example, to set a
* custom `flashVer` string that identifies your application to the server.
*/
class RtmpEndpointFactory : IEndpointInternal.Factory {
class RtmpEndpointFactory(
private val clientSettings: RtmpClientSettings = RtmpClientSettings()
) : IEndpointInternal.Factory {
override fun create(
context: Context, dispatcherProvider: IDispatcherProvider
): IEndpointInternal = RtmpEndpoint(dispatcherProvider.default, dispatcherProvider.io)
): IEndpointInternal =
RtmpEndpoint(dispatcherProvider.default, dispatcherProvider.io, clientSettings)
}
Loading