@@ -46,12 +46,12 @@ class RtmpConnectionBuilder(val selectorManager: SelectorManager) {
4646 * The [urlBuilder] must use the `rtmp`, `rtmps`, `rtmpt` or `rtmpts` protocol.
4747 *
4848 * @param urlBuilder the URL to connect to
49- * @param configure the settings for the RTMP client
49+ * @param settings the settings for the RTMP client
5050 * @param message the callback to handle RTMP client events
5151 */
5252 suspend fun connect (
5353 urlBuilder : URLBuilder ,
54- configure : RtmpClientSettings .() -> Unit = {} ,
54+ settings : RtmpClientSettings = RtmpClientSettings () ,
5555 message : RtmpClientCallbackBuilder .() -> Unit = {}
5656 ): RtmpClient {
5757 urlBuilder.validateRtmp()
@@ -66,18 +66,17 @@ class RtmpConnectionBuilder(val selectorManager: SelectorManager) {
6666 TcpSocket (tcpSocket, urlBuilder)
6767 }
6868
69- return connect(socket, configure , message)
69+ return connect(socket, settings , message)
7070 }
7171
7272 /* *
7373 * Connects to the given [socket] and performs the RTMP handshake.
7474 */
7575 private suspend fun connect (
7676 socket : ISocket ,
77- configure : RtmpClientSettings .() -> Unit ,
77+ settings : RtmpClientSettings ,
7878 message : RtmpClientCallbackBuilder .() -> Unit
7979 ): RtmpClient {
80- val settings = RtmpClientSettings ().apply { configure() }
8180 try {
8281 socket.clientHandshake(settings.clock)
8382 } catch (t: Throwable ) {
@@ -103,30 +102,30 @@ class RtmpConnectionBuilder(val selectorManager: SelectorManager) {
103102 * Binds a new [RtmpServer] to the given [localAddress].
104103 *
105104 * @param localAddress the local address to bind to. If null, binds to a random port on all interfaces.
106- * @param configure the settings for the RTMP server
105+ * @param settings the settings for the RTMP server
107106 * @param message the callback to handle RTMP server events
108107 * @return a new [RtmpServer] instance
109108 */
110109 suspend fun bind (
111110 localAddress : SocketAddress ? = null,
112- configure : RtmpServerSettings .() -> Unit = {} ,
111+ settings : RtmpServerSettings = RtmpServerSettings () ,
113112 message : RtmpServerCallbackBuilder .() -> Unit = {}
114113 ): RtmpServer {
115114 val serverSocket = tcpSocketBuilder.bind(localAddress)
116115
117- return bind(serverSocket, configure , message)
116+ return bind(serverSocket, settings , message)
118117 }
119118
120119 /* *
121120 * Binds a new [RtmpServer] to the given [serverSocket].
122121 */
123122 private fun bind (
124123 serverSocket : ServerSocket ,
125- settings : RtmpServerSettings .() -> Unit ,
124+ settings : RtmpServerSettings ,
126125 messages : RtmpServerCallbackBuilder .() -> Unit
127126 ) = RtmpServer (
128127 serverSocket,
129- RtmpServerSettings (). apply { settings() } ,
128+ settings,
130129 RtmpServerCallbackBuilder ().apply { messages() }
131130 )
132131}
@@ -137,28 +136,28 @@ class RtmpConnectionBuilder(val selectorManager: SelectorManager) {
137136 * The [urlString] must use the `rtmp`, `rtmps`, `rtmpt` or `rtmpts` protocol.
138137 *
139138 * @param urlString the RTMP URL to connect to
140- * @param configure the settings for the RTMP client
139+ * @param settings the settings for the RTMP client
141140 * @param message the callback to handle RTMP client events
142141 */
143142suspend fun RtmpConnectionBuilder.connect (
144143 urlString : String ,
145- configure : RtmpClientSettings .() -> Unit = {} ,
144+ settings : RtmpClientSettings = RtmpClientSettings () ,
146145 message : RtmpClientCallbackBuilder .() -> Unit = {}
147- ) = connect(RtmpURLBuilder (urlString), configure , message)
146+ ) = connect(RtmpURLBuilder (urlString), settings , message)
148147
149148/* *
150149 * Binds a new [RtmpServer] to the given [urlString].
151150 *
152151 * The [urlString] must be in the format `tcp://host:port` or `host:port`.
153152 *
154153 * @param urlString the URL string to bind to
155- * @param configure the settings for the RTMP server
154+ * @param settings the settings for the RTMP server
156155 * @param message the callback to handle RTMP server events
157156 * @return a new [RtmpServer] instance
158157 */
159158suspend fun RtmpConnectionBuilder.bind (
160159 urlString : String ,
161- configure : RtmpServerSettings .() -> Unit = {} ,
160+ settings : RtmpServerSettings = RtmpServerSettings () ,
162161 message : RtmpServerCallbackBuilder .() -> Unit = {}
163162): RtmpServer {
164163 val url = if (urlString.startWithScheme()) {
@@ -173,5 +172,5 @@ suspend fun RtmpConnectionBuilder.bind(
173172 url.port
174173 }
175174 )
176- return bind(localAddress, configure , message)
175+ return bind(localAddress, settings , message)
177176}
0 commit comments