Scenario: Encrypted mp3 files in my .apk. You must decrypt and send the MediaPlayer object.
Problem: After I read the files and decrypted them, how do I get MediaPlayer to play them?
Now. MediaPlayer has 4 versions of setDataSource ().
setDataSource(String path) setDataSource(FileDescriptor fd) setDataSource(FileDescriptor fd, long offset, long length) setDataSource(Context context, Uri uri)
None of them are ideal for the situation. Guess idea is to provide MediaPlayer InputStream?
Possible solutions:
- Write decrypted data to the file this file. A lot of IO overhead.
- Create a dummy http server (ServerSocket?) And pass the URL of the media player. Again dirty. I am even allowed to create a socket.
Does anyone have a better solution?
source share