Hello, I’m using the SDK for Android and I’m having trouble closing a video stream before exiting that activity. I looked the samples, read the docs and no clue whatsoever…
Currently I have tried this methods:
- xpMobileSDK.stopVideoStream: this method effectively stops the video, but from what I have seend, a background thread throws some errors because it is expecting the video frames. The error I usually get is this:
D/VideoChannelThread: Exception in vStream.receiveResponse()
java.net.SocketTimeoutException: failed to connect to /10.51.70.2 (port 8081) after 10000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:169)
at libcore.io.IoBridge.connect(IoBridge.java:122)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:456)
at java.net.Socket.connect(Socket.java:882)
at com.android.okhttp.internal.Platform.connectSocket(Platform.java:174)
at com.android.okhttp.Connection.connect(Connection.java:1222)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:395)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:298)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:399)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:349)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseMessage(HttpURLConnectionImpl.java:513)
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:398)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread.access$1200(VideoChannelThread.java:25)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread$1.run(VideoChannelThread.java:241)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Thread for VideoStream 'b8af71d4-406c-4cb5-9adb-85c5feab9fc1' will be closed.
Thread for VideoStream 'b8af71d4-406c-4cb5-9adb-85c5feab9fc1' has been closed!
W/System.err: java.util.concurrent.CancellationException
at java.util.concurrent.FutureTask.report(FutureTask.java:92)
at java.util.concurrent.FutureTask.get(FutureTask.java:163)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread.run(VideoChannelThread.java:280)
Also sometimes this error occurs:
E/HTTPConnection: Exception while sending request!:
java.net.SocketTimeoutException: failed to connect to /10.51.70.2 (port 8081) after 10000ms
Sometimes I even get some infinite errors like this one:
Exception while reading video stream!
java.io.IOException: unexpected end of stream
at com.android.okhttp.internal.http.HttpConnection$ChunkedSource.read(HttpConnection.java:525)
at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:174)
at com.milestonesys.xpmobilesdk.communication.VideoChannelThread$1.run(VideoChannelThread.java:127)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
(Please note this three errors occur from executing the stopVideoSteam method, just that sometimes is one, sometimes is other)
- xpMobileSDK.cancelRequest (doesn’t do anything to me, doesn’t even get to the callback)
Please, I would appreciate your help.