File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
library/src/main/java/com/pedro/library/util/streamclient
rtmp/src/main/java/com/pedro/rtmp/rtmp Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -185,4 +185,11 @@ class RtmpStreamClient(
185185 fun setCustomAmfObject (amfObject : Map <String , Any >) {
186186 rtmpClient.setCustomAmfObject(amfObject)
187187 }
188+
189+ /* *
190+ * Should notify onConnectionFailed if read packet from the server failed
191+ */
192+ fun shouldFailOnRead (enabled : Boolean ) {
193+ rtmpClient.shouldFailOnRead = enabled
194+ }
188195}
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ class RtmpClient(private val connectChecker: ConnectChecker) {
108108 get() = rtmpSender.bytesSend
109109 var socketType = SocketType .KTOR
110110 var socketTimeout = StreamSocket .DEFAULT_TIMEOUT
111+ var shouldFailOnRead = false
111112
112113 /* *
113114 * Add certificates for TLS connection
@@ -317,7 +318,7 @@ class RtmpClient(private val connectChecker: ConnectChecker) {
317318 }.exceptionOrNull()
318319 if (error != null && ConnectionFailed .parse(error.validMessage()) != ConnectionFailed .TIMEOUT ) {
319320 scope.cancel()
320- connectChecker.onConnectionFailed(error.validMessage())
321+ if (shouldFailOnRead) connectChecker.onConnectionFailed(error.validMessage())
321322 }
322323 }
323324 }
You can’t perform that action at this time.
0 commit comments