I would suggest taking a look at the UriDataSourceor interface DataSource. You can get from DataSourceand provide an implementation very similar to UriDataSource, and pass it to ExoPlayer. This class has access to the method read()through which all bytes pass. This method allows you to decrypt files on the fly one buffer at a time.
In ExoPlayer 2.0, you provide your own of DataSourceyour own DataSource.Factory, which you can transfer to ExtractorMediaSource(or any other MediaSource).
ExoPlayer 2.0, DataSource ExtractorSampleSource, VideoRenderer AudioRender buildRenderers() RendererBuilder, .
( " " Google ", , , , - , - ).
read():
@Override
public int read(byte[] buffer, int offset, int readLength) throws IOException {
if (bytesRemaining == 0) {
return -1;
} else {
int bytesRead = 0;
try {
long filePointer = randomAccessFile.getFilePointer();
bytesRead =
randomAccessFile.read(buffer, offset, (int) Math.min(bytesRemaining, readLength));
AesEncrypter.decrypt(buffer, offset, bytesRead, filePointer);
} catch (EOFException eof) {
Log.v("Woo", "End of randomAccessFile reached.");
}
if (bytesRead > 0) {
bytesRemaining -= bytesRead;
if (listener != null) {
listener.onBytesTransferred(bytesRead);
}
}
return bytesRead;
}
}
[EDIT] SO post, .