Now the problem is, after 3-4 seconds, the video playback stops but the file downloading continues. If I hit the pause button and then the playback button after 4-5 seconds, the playback is ok otherwise the picture remains frozen. I am not sure where to start but am guessing the problem has something to do with buffer sizes which are something like this:
When B connects to A, A writes into a buffer of size 1024.
B reads from the socket into a buffer of size 1024.
B then writes into the socket where VLC is listening with a buffer of size 1024.
The snippet where B writes to VLC as well as a file locally is shown here:
Code: Select all
while((bytesRead = is.read(fileByteArray, 0, fileByteArray.length)) > 0) {
out.write(fileByteArray, 0, bytesRead); //Output stream of VLC player socket
bos.write(fileByteArray, 0, bytesRead); //Buffered output stream into a file
}
out.flush();
Can someone please advice me on where to start troubleshooting for this problem? One useful hint I could gather is that, once the playback is complete, the machine looks first in its local cache so it finds the newly downloaded video and starts playing without any problem....