#StackBounty: #java #google-chrome #video-streaming #html5-video render video stream as partial content rather than full stream to chrome

Bounty: 100

We currently submit a video playback request to back end server the sends the full stream as inputstream to be played back in the browser(window). This works fine but has an added complication in that the seek function does not work in chrome. The suggested solution is to tell the webserver that it needs to accept a byte range and then deliver the stream in partial byte ranges. I am not sure if this will resolve the situation but my question is how to return the stream in byte ranges considering the following is the way it is done now:

    InputStream is= null;
    is = new FileInputStream(ndirectoryFile);

    //(calling class request)
    stream = videoWrapper.getVideo(id, address);

If I read the file in byte ranges, do I just loop through the file but how do I send the response:

InputStream is = new ByteArrayInputStream(new byte[] { 0, 1, 2 }); 
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[1024];
while ((nRead = is.read(data, 0, data.length)) != -1) {
    buffer.write(data, 0, nRead);

byte[] byteArray = buffer.toByteArray(

The initial inputstream gets passed to quite a few classes along the way prior to sending the final response. Any ideas please.


I would like to just understand the html5 video issue with chrome. There are quite a few posts on setting the server response headers to include Accept-Ranges=, Content-length= , Content-Range= and this would tell chrome to download the byte range which will then allow seek feature to work. As the video playback seek works in firefox I should not have to change how I deliver the stream or would I? Would I still have to submit partial ranges of the video from the server? and how?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.