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
FieldsModifier and TypeFieldDescriptionstatic final Parcelable.Creator<MemoryHlsClearKeyCache> Creator for Parcelable implementation.static final intDefault maximum cache sizeFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty cache with a size ofDEFAULT_CACHE_SIZEMemoryHlsClearKeyCache(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_SIZEand pre-filled with the provided Map. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsUri(Uri uri) Checks if a URI is present in the cache.intbyte[]Returns the encryption key cached against the given URI.byte[]Inserts an entry into the cache.byte[]Removes a URI from the cache.voidwriteToParcel(Parcel dest, int flags)
-
Field Details
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZEDefault maximum cache size- See Also:
-
CREATOR
Creator for Parcelable implementation. This creator is used to create instances of MemoryHlsClearKeyCache from a Parcel.
-
-
Constructor Details
-
MemoryHlsClearKeyCache
public MemoryHlsClearKeyCache()Create an empty cache with a size ofDEFAULT_CACHE_SIZE -
MemoryHlsClearKeyCache
Create a cache with a size ofDEFAULT_CACHE_SIZEand 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:
writeToParcelin interfaceParcelable
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceParcelable
-
get
Description copied from class:HlsClearKeyCacheReturns the encryption key cached against the given URI.- Specified by:
getin classHlsClearKeyCache- Parameters:
uri- The URI to look up in the cache- Returns:
- The cached encryption key, or null if the URI is not in the cache
-
put
Description copied from class:HlsClearKeyCacheInserts an entry into the cache.- Specified by:
putin classHlsClearKeyCache- Parameters:
uri- The URI to cache the encryption key againstencryptionKey- The encryption key to cache- Returns:
- The previous encryption key associated with the URI, or null if there was none
-
containsUri
Description copied from class:HlsClearKeyCacheChecks if a URI is present in the cache.- Specified by:
containsUriin classHlsClearKeyCache- Parameters:
uri- The URI to check- Returns:
- true if the URI is present in the cache, false otherwise
-
remove
Description copied from class:HlsClearKeyCacheRemoves a URI from the cache.- Specified by:
removein classHlsClearKeyCache- Parameters:
uri- The URI to remove from the cache- Returns:
- The encryption key that was associated with the URI, or null if the URI was not in the cache
-