Android Question Videoview from inputstream

Javier Alonso

Licensed User
Longtime User

I would like to play a video in videoview using an array of byte (or an inputstream) as the source. The reason is that I have decrypted the video first:

inStream = File.OpenInput(..., ...)
File.Copy2(inStream, outStream)
Buffer = outStream.ToBytesArray

cph.InitialisationVector = iv
Buffer = cph.Decrypt(Buffer, key.Key, True)

Right here, Buffer holds the decrypted file.

inStream.InitializeFromBytesArray(Buffer, 0, Buffer.Length)

And now inStream holds it as an inputstream

But videoview only accepts a file or an URL as source, and I would not like to write the decrypted file to the file system not to make it accesible by other apps. Could it work using an intent to open another activity in my app? No idea how to do it.

Any help welcome. Thank you all.