Class AesMediaDataSource


  • public class AesMediaDataSource
    extends MediaDataSource
    Seekable source for encrypted media content.
    • Constructor Summary

      Constructors 
      Constructor Description
      AesMediaDataSource​(Activity activity, AesFile aesFile, int buffers, int bufferSize, int threads, int backOffset)
      Construct a seekable source for the android media player from an encrypted file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the source and all associated resources.
      long getSize()
      Get the content size.
      int readAt​(long position, byte[] buffer, int offset, int size)
      Decrypts and reads the contents of an encrypted file
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AesMediaDataSource

        public AesMediaDataSource​(Activity activity,
                                  AesFile aesFile,
                                  int buffers,
                                  int bufferSize,
                                  int threads,
                                  int backOffset)
                           throws java.lang.Exception
        Construct a seekable source for the android media player from an encrypted file.
        Parameters:
        activity - Activity this data source will be used with. This is usually the activity the MediaPlayer is attached to
        aesFile - AesFile that will be used as a source
        buffers - The buffers
        bufferSize - Buffer size
        threads - Threads for parallel processing
        backOffset - The backwards offset to use when reading buffers
        Throws:
        java.lang.Exception - Thrown if error occured
    • Method Detail

      • readAt

        public int readAt​(long position,
                          byte[] buffer,
                          int offset,
                          int size)
                   throws java.io.IOException
        Decrypts and reads the contents of an encrypted file
        Parameters:
        position - The source file position the read will start from
        buffer - The buffer that will store the decrypted contents
        offset - The position on the buffer that the decrypted data will start
        size - The length of the data requested
        Throws:
        java.io.IOException
      • getSize

        public long getSize()
        Get the content size.
        Returns:
        The size
      • close

        public void close()
                   throws java.io.IOException
        Close the source and all associated resources.
        Throws:
        java.io.IOException - Thrown if error during IO