Currently when testing our server and Android app the live video stream is disconnecting for some reason after ~2-3 minutes. This occurs with the Milestone XProtect app also, however the XProtect app detects the stream stopped and reconnects.
The SDK LiveVideo class catches and consumes an exception that the stream has disconnected but provides no way to notify the containing app.
I discovered in the SDK ‘ConnectivityStateReceiver’ however this only fires changes on network state, in our case the video stops even though network connectivity has not changed.
Exception when stream stops is as follows:
2019-12-06 16:29:01.530 26465-26568/app.plugin.milestone D/VideoChannelThread: Exception in vStream.receiveResponse()
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:215)
at java.net.SocketInputStream.read(SocketInputStream.java:144)
at com.android.okhttp.okio.Okio$2.read(Okio.java:145)
at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:213)
at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:317)
at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:311)
at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:207)
at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:388)
at com.android.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:146)
at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:900)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:772)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:493)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:429)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseMessage(HttpURLConnectionImpl.java:556)
at com.milestonesys.xpmobilesdk.communication.HTTPConnection.getResponseInputStream(HTTPConnection.java:284)
at com.milestonesys.xpmobilesdk.communication.HTTPConnection.receiveResponse(HTTPConnection.java:273)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread.pullVideo(VideoChannelThread.java:393)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread.access$1200(VideoChannelThread.java:23)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread$1.run(VideoChannelThread.java:239)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2019-12-06 16:29:01.530 26465-26568/cs.android.milestone D/VideoChannelThread: Thread for VideoStream '0235dec0-aaee-4805-b6a3-c04bb0b344ae' will be closed.
2019-12-06 16:29:01.530 26465-26568/cs.android.milestone D/VideoChannelThread: Thread for VideoStream '0235dec0-aaee-4805-b6a3-c04bb0b344ae' has been closed!
Even after this the server connection is still OK as I’m getting keep alive live messages:
2019-12-06 16:29:37.557 26465-26547/app.plugin.milestone D/SdkWrapper: LiveMessage: Command { seq: 0, name: LiveMessage, type: Response, result: OK, outputParams: { {Timeout=30} } }
I suspect the disconnect is firewall related, however as this is a possible problem for users I would like to ensure they are never left looking at a stream that is actually stopped.
This is using 2019 R3 SDK and Server.