Package com.castlabs.android.player
Class MemoryHlsClearKeyCache
java.lang.Object
com.castlabs.android.player.HlsClearKeyCache
com.castlabs.android.player.MemoryHlsClearKeyCache
- All Implemented Interfaces:
Parcelable
Cache for
Drm.Clearkey
which stores keys in memory.
Can be gotten
or PlayerController.setHlsKeyCache(HlsClearKeyCache)
set}
in the PlayerController.
-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Parcelable.Creator
<MemoryHlsClearKeyCache> static final int
Default maximum cache sizeFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorDescriptionCreate an empty cache with a size ofDEFAULT_CACHE_SIZE
MemoryHlsClearKeyCache
(int maxCacheSize, Map<Uri, byte[]> cache) Creates a cache with a size of maxCacheSize and pre-filled with the provided Map.MemoryHlsClearKeyCache
(Map<Uri, byte[]> cache) Create a cache with a size ofDEFAULT_CACHE_SIZE
and pre-filled with the provided Map. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsUri
(Uri uri) Returns true ifuri
is present in the cache.int
byte[]
Returns theencryptionKey
cached against thisuri
, or null ifuri
is null or not present in the cache.byte[]
Inserts an entry into the cache.byte[]
Removesuri
from the cache.void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZEDefault maximum cache size- See Also:
-
CREATOR
-
-
Constructor Details
-
MemoryHlsClearKeyCache
public MemoryHlsClearKeyCache()Create an empty cache with a size ofDEFAULT_CACHE_SIZE
-
MemoryHlsClearKeyCache
Create a cache with a size ofDEFAULT_CACHE_SIZE
and pre-filled with the provided Map.- Parameters:
cache
- Existing entries to pre-fill the cache with
-
MemoryHlsClearKeyCache
Creates a cache with a size of maxCacheSize and pre-filled with the provided Map.- Parameters:
maxCacheSize
- Maximum size of the cachecache
- Existing entries to pre-fill the cache with
-
-
Method Details
-
writeToParcel
- Specified by:
writeToParcel
in interfaceParcelable
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceParcelable
-
get
Description copied from class:HlsClearKeyCache
Returns theencryptionKey
cached against thisuri
, or null ifuri
is null or not present in the cache.- Specified by:
get
in classHlsClearKeyCache
-
put
Description copied from class:HlsClearKeyCache
Inserts an entry into the cache.- Specified by:
put
in classHlsClearKeyCache
-
containsUri
Description copied from class:HlsClearKeyCache
Returns true ifuri
is present in the cache.- Specified by:
containsUri
in classHlsClearKeyCache
-
remove
Description copied from class:HlsClearKeyCache
Removesuri
from the cache. Ifuri
was present in the cahce, this returns the correspondingencryptionKey
, otherwise null.- Specified by:
remove
in classHlsClearKeyCache
-