I am downloading an mp4 video into a local disk drive from an intranet as the following:
while ((bufferLength = inputstram.read(buffer)) > 0) {
fileOutputStream.write(buffer, 0, bufferLength);
//play(buffer);
downloadedSize += bufferLength;
System.out.println("remaining: " + downloadedSize + " out of " + totalSize);
}
While downloading (after fileOutputStream.write(buffer, 0, bufferLength);
statement), I need to play the downloaded buffers in the while loop in exoplayer. How can I do that? I was searching in google and into exoplayer docs but I couldn't find a straight forward answer.
At the moment, I am playing a video in exoplayer as a URL as the following code:
MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse("http://myhappy_video.mp4"));
So how can I change that to play buffered bytes from input stream as a video?