se-bastiaan/TorrentStreamServer-Android

Cannot start stream

Closed this issue · 5 comments

Lyazz commented

Hello there, I'am facing an issue regarding the library, when I try to stream a torrent, the stream loads and when it comes to be read on VLC, I got this. Thank you in advance:
E/NanoHTTPD: Communication with the client broken, or an bug in the handler code java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 at com.github.se_bastiaan.torrentstream.Torrent.hasBytes(Torrent.java:321) at com.github.se_bastiaan.torrentstream.TorrentInputStream.waitForPiece(TorrentInputStream.java:35) at com.github.se_bastiaan.torrentstream.TorrentInputStream.read(TorrentInputStream.java:64) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1687) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1664) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1654) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$Response.send(NanoHTTPD.java:1621) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:954) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:189) at java.lang.Thread.run(Thread.java:919) E/NanoHTTPD: Communication with the client broken, or an bug in the handler code java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 at com.github.se_bastiaan.torrentstream.Torrent.setInterestedBytes(Torrent.java:338) at com.github.se_bastiaan.torrentstreamserver.TorrentStreamWebServer.serveTorrent(TorrentStreamWebServer.java:160) at com.github.se_bastiaan.torrentstreamserver.TorrentStreamWebServer.serve(TorrentStreamWebServer.java:67) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:942) at com.github.se_bastiaan.torrentstreamserver.nanohttpd.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:189) at java.lang.Thread.run(Thread.java:919)

It looks like your torrent has no data in it. Please share some of your code. How do you start and listen? Was onStreamReady even called?

Lyazz commented

I used exactly the same code you provided but in a new projet where I imported the library.
The onStreamReady is called in the end but onStreamProgress is never called. finally I got the popup to start the stream, when I click on it the app crashes with the error above.

The example code? Did you change the torrent that is used?

Lyazz commented

The problem has been solved when I downgraded the version of the library in the project dependencies. Thank you.

That does not sound like the best solution to me, but if it's okay for you then I'll close this issue.