我是NanoHttpd的新手。我正在使用它在Android中流式传输视频。对于正常的游戏来说,这就像一个没有任何问题的魅力。但是当我试图在VideoPlayer中寻找不同的时间时,立即得到以下错误,它创建了一个不同的套接字,并在一段时间后恢复播放。但它长时间显示进度指示器,我认为由于这个问题并重新连接不同的socket。 Streaming来自本地网络服务器。
java.net.SocketException: sendto failed: EPIPE (Broken pipe)
at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:546)
at libcore.io.IoBridge.sendto(IoBridge.java:515)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:504)
at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1423)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1396)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1386)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.send(NanoHTTPD.java:1371)
at me.etrmntonwheels.surfacetest.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:794)
at me.etrmntonwheels.surfacetest.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:195)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.system.ErrnoException: sendto failed: EPIPE (Broken pipe)
at libcore.io.Posix.sendtoBytes(Native Method)
at libcore.io.Posix.sendto(Posix.java:206)
at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
at libcore.io.IoBridge.sendto(IoBridge.java:513)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:504)
at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1423)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1396)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1386)
at me.etrmntonwheels.surfacetest.NanoHTTPD$Response.send(NanoHTTPD.java:1371)
at me.etrmntonwheels.surfacetest.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:794)
at me.etrmntonwheels.surfacetest.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:195)
at java.lang.Thread.run(Thread.java:818)
我正在使用SimpleWebServer示例中的serveFile函数来实现部分内容或流式传输。我已经阅读了不同的文章,并通过stackoverflow搜索,但仍然无法弄清楚原因。我长期坚持这个问题。请帮我解决这个问题。
找到simpleWebServer文件