Android Question Videoview from inputstream

Discussion in 'Android Questions' started by Javier Alonso, May 3, 2015.

  1. Javier Alonso

    Javier Alonso Member Licensed User

    Hi,

    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(..., ...)
    outStream.InitializeToBytesArray(1000)
    File.Copy2(inStream, outStream)
    Buffer = outStream.ToBytesArray
    outStream.Close

    cph.Initialize("AES/CFB/PKCS5Padding")
    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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    Note that File.DirInternal on unrooted devices is only accessible to your app.

    I don't see how an intent will help here. I think that you will need to create a temporary file with the data.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice