public class LocalAssetsManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
LocalAssetsManager.AssetRegistrationListener
Listener that notify about the result when registration flow is ended.
|
static interface |
LocalAssetsManager.AssetRemovalListener
Will notify when the asset was removed from the manager.
|
static interface |
LocalAssetsManager.AssetStatusListener
Will notify about the status of the requested asset.
|
static class |
LocalAssetsManager.DefaultLocalDataStore
Default implementation of the
LocalDataStore . |
static class |
LocalAssetsManager.LocalMediaSource
The local media source that should be passed to the player
when offline(locally stored) media want to be played.
|
Constructor and Description |
---|
LocalAssetsManager(android.content.Context context)
Constructor which will create
LocalAssetsManager.DefaultLocalDataStore |
LocalAssetsManager(android.content.Context context,
LocalDataStore localDataStore)
Constructor with custom implementation of the
LocalDataStore |
Modifier and Type | Method and Description |
---|---|
void |
checkAssetStatus(java.lang.String localAssetPath,
java.lang.String assetId,
LocalAssetsManager.AssetStatusListener listener)
Check the status of the desired asset.
|
PKMediaSource |
getLocalMediaSource(java.lang.String assetId,
java.lang.String localAssetPath) |
void |
refreshAsset(PKMediaSource mediaSource,
java.lang.String localAssetPath,
java.lang.String assetId,
LocalAssetsManager.AssetRegistrationListener listener) |
void |
registerAsset(PKMediaSource mediaSource,
java.lang.String localAssetPath,
java.lang.String assetId,
LocalAssetsManager.AssetRegistrationListener listener)
Register the asset.
|
void |
unregisterAsset(java.lang.String localAssetPath,
java.lang.String assetId,
LocalAssetsManager.AssetRemovalListener listener)
Unregister asset.
|
public LocalAssetsManager(android.content.Context context)
LocalAssetsManager.DefaultLocalDataStore
context
- - the application context.public LocalAssetsManager(android.content.Context context, LocalDataStore localDataStore)
LocalDataStore
context
- - the application context.localDataStore
- - custom implementation of LocalDataStore
public void registerAsset(@NonNull PKMediaSource mediaSource, @NonNull java.lang.String localAssetPath, @NonNull java.lang.String assetId, LocalAssetsManager.AssetRegistrationListener listener)
PKMediaFormat
in LocalDataStore
If no drm available only as byte[]
will be stored.mediaSource
- - the source to register.localAssetPath
- - the url of the locally stored asset.assetId
- - the asset id.listener
- - notify about the success/fail after the completion of the registration process.public void unregisterAsset(@NonNull java.lang.String localAssetPath, @NonNull java.lang.String assetId, LocalAssetsManager.AssetRemovalListener listener)
LocalDataStore
In any case the PKMediaFormat
will be removed from LocalDataStore
localAssetPath
- - the url of the locally stored asset.assetId
- - the asset idlistener
- - notify when the asset is removed.public void refreshAsset(@NonNull PKMediaSource mediaSource, @NonNull java.lang.String localAssetPath, @NonNull java.lang.String assetId, LocalAssetsManager.AssetRegistrationListener listener)
public void checkAssetStatus(@NonNull java.lang.String localAssetPath, @NonNull java.lang.String assetId, @Nullable LocalAssetsManager.AssetStatusListener listener)
localAssetPath
- - the url of the locally stored asset.assetId
- - the asset id.listener
- - will pass the result of the status.public PKMediaSource getLocalMediaSource(@NonNull java.lang.String assetId, @NonNull java.lang.String localAssetPath)
assetId
- - the id of the asset.localAssetPath
- - the actual url of the video that should be played.PKMediaSource
that should be passed to the player.