user4595813
user4595813

Reputation:

stream video on device bytewise to videoview - Android

I want to play encrypted video files present on my device after decrypting them. I want to pre-process the data-stream and parallel play it using videoview like streaming video from Internet.

Is there any way I could buffer the processed data to videoview like a network stream ?

Upvotes: 0

Views: 532

Answers (1)

Mick
Mick

Reputation: 25471

I think you are saying that you want to decrypt the video in one process and then pass the decrypted 'clear stream' video to another process to play it?

If the video is DRM protected, then your use case is very unlikely to be supported by any of the leading DRM solutions - they go to great lengths to ensure the clear stream video is not accessible by an application on the device (for obvious reasons).

If you are using or a simple encryption with the encryption key available to your application then you should be able to do this.

Update Answering BMvit's question in the comment - one way is to follow these steps:

  1. Stream the encrypted file from the server as usual, 'chunk by chunk'
  2. On your Android device, read from the stream and decrypt each chunk as it is received
  3. Using a localhost http server on your Android device, now 'serve' the decrypted chunks to the MediaPlayer (the media player should be set up to use a URL pointing at your localhost http server)

I am guessing this is the most likely the approach that the libMedia library uses, although I have never seen the source so I could not say for sure: http://libeasy.alwaysdata.net

It is worth being aware that this is tricky (which is probably why LibMedia is not free).

Upvotes: 1

Related Questions