Reputation: 749
I have developed Spring based web application to see videos. It's working good via desktop. But if i try to open my application from iPad and iPhone i can't play video. Because jwplayer can't get data from server. jwplayer display the error like "The video could not be loaded, either because the server or network failed, or because the format is not supported", Same time server side error is
Caused by: java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at org.mortbay.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:170)
at org.mortbay.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:221)
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:725)
I have searched net and findout the reason. Client(iPad/iPhone) terminate server connection. That's Broken Pipe Exception. Please refer my server side code also
private void sendFile(HttpServletResponse response, String filename, String directory, String contentType, String extention) throws IOException, InterruptedException {
final String file = directory + File.separator + filename + "." + extention;
response.setContentLength((int) new File(file).length());
response.setContentType(contentType);
try {
FileInputStream inputStream = new FileInputStream(file);
ServletOutputStream outputStream = response.getOutputStream();
IOUtils.copyLarge(inputStream, outputStream);
IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
} catch (Exception exp) {
exp.printStackTrace();
}
response.setStatus(HttpServletResponse.SC_OK);
}
Broken Pipe occurred while copying inputStream to outputStream, IOUtils.copyLarge(inputStream, outputStream).
How can i solve this problem. Anyone please guide me in proper way..
Thanks in Advance..
Upvotes: 2
Views: 231
Reputation: 311008
Solve which problem? The solution to the unsupported video problem is to send a supported video type, and the solution to the broken pipe exception is to solve the unsupported video problem.
Upvotes: 1