Class FrameworkMediaDrm
- java.lang.Object
-
- com.google.android.exoplayer2.drm.FrameworkMediaDrm
-
- All Implemented Interfaces:
ExoMediaDrm
@RequiresApi(18) @Deprecated public final class FrameworkMediaDrm extends Object implements ExoMediaDrm
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.AnExoMediaDrm
implementation that wraps the frameworkMediaDrm
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.drm.ExoMediaDrm
ExoMediaDrm.AppManagedProvider, ExoMediaDrm.KeyRequest, ExoMediaDrm.KeyStatus, ExoMediaDrm.OnEventListener, ExoMediaDrm.OnExpirationUpdateListener, ExoMediaDrm.OnKeyStatusChangeListener, ExoMediaDrm.Provider, ExoMediaDrm.ProvisionRequest
-
-
Field Summary
Fields Modifier and Type Field Description static ExoMediaDrm.Provider
DEFAULT_PROVIDER
Deprecated.ExoMediaDrm.Provider
that returns a newFrameworkMediaDrm
for the requested UUID.-
Fields inherited from interface com.google.android.exoplayer2.drm.ExoMediaDrm
EVENT_KEY_EXPIRED, EVENT_KEY_REQUIRED, EVENT_PROVISION_REQUIRED, KEY_TYPE_OFFLINE, KEY_TYPE_RELEASE, KEY_TYPE_STREAMING
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
acquire()
Deprecated.Increments the reference count.void
closeSession(byte[] sessionId)
Deprecated.Closes a DRM session.FrameworkCryptoConfig
createCryptoConfig(byte[] sessionId)
Deprecated.Creates aCryptoConfig
that can be passed to a compatible decoder to allow decryption of protected content using the specified session.@com.google.android.exoplayer2.C.CryptoType int
getCryptoType()
Deprecated.ExoMediaDrm.KeyRequest
getKeyRequest(byte[] scope, List<DrmInitData.SchemeData> schemeDatas, int keyType, HashMap<String,String> optionalParameters)
Deprecated.Generates a key request.PersistableBundle
getMetrics()
Deprecated.Returns metrics data for this ExoMediaDrm instance, ornull
if metrics are unavailable.byte[]
getPropertyByteArray(String propertyName)
Deprecated.Returns the value of a byte array property.String
getPropertyString(String propertyName)
Deprecated.Returns the value of a string property.ExoMediaDrm.ProvisionRequest
getProvisionRequest()
Deprecated.Generates a provisioning request.static boolean
isCryptoSchemeSupported(UUID uuid)
Deprecated.Returns whether the DRM scheme with the given UUID is supported on this device.static FrameworkMediaDrm
newInstance(UUID uuid)
Deprecated.Creates an instance with an initial reference count of 1.byte[]
openSession()
Deprecated.Opens a new DRM session.byte[]
provideKeyResponse(byte[] scope, byte[] response)
Deprecated.Provides a key response for the last request to be generated usingExoMediaDrm.getKeyRequest(byte[], java.util.List<com.google.android.exoplayer2.drm.DrmInitData.SchemeData>, int, java.util.HashMap<java.lang.String, java.lang.String>)
.void
provideProvisionResponse(byte[] response)
Deprecated.Provides a provisioning response for the last request to be generated usingExoMediaDrm.getProvisionRequest()
.Map<String,String>
queryKeyStatus(byte[] sessionId)
Deprecated.Returns the key status for a given session, as {name, value} pairs.void
release()
Deprecated.Decrements the reference count.boolean
requiresSecureDecoder(byte[] sessionId, String mimeType)
Deprecated.Returns whether the given session requires use of a secure decoder for the given MIME type.void
restoreKeys(byte[] sessionId, byte[] keySetId)
Deprecated.Restores persisted offline keys into a session.void
setOnEventListener(ExoMediaDrm.OnEventListener listener)
Deprecated.Sets the listener for DRM events.void
setOnExpirationUpdateListener(ExoMediaDrm.OnExpirationUpdateListener listener)
Deprecated.Sets the listener for session expiration events.void
setOnKeyStatusChangeListener(ExoMediaDrm.OnKeyStatusChangeListener listener)
Deprecated.Sets the listener for key status change events.void
setPlayerIdForSession(byte[] sessionId, PlayerId playerId)
Deprecated.Sets thePlayerId
of the player using a session.void
setPropertyByteArray(String propertyName, byte[] value)
Deprecated.Sets the value of a byte array property.void
setPropertyString(String propertyName, String value)
Deprecated.Sets the value of a string property.
-
-
-
Field Detail
-
DEFAULT_PROVIDER
public static final ExoMediaDrm.Provider DEFAULT_PROVIDER
Deprecated.ExoMediaDrm.Provider
that returns a newFrameworkMediaDrm
for the requested UUID. Returns aDummyExoMediaDrm
if the protection scheme identified by the given UUID is not supported by the device.
-
-
Method Detail
-
isCryptoSchemeSupported
public static boolean isCryptoSchemeSupported(UUID uuid)
Deprecated.Returns whether the DRM scheme with the given UUID is supported on this device.- See Also:
MediaDrm.isCryptoSchemeSupported(UUID)
-
newInstance
public static FrameworkMediaDrm newInstance(UUID uuid) throws UnsupportedDrmException
Deprecated.Creates an instance with an initial reference count of 1.release()
must be called on the instance when it's no longer required.- Parameters:
uuid
- The scheme uuid.- Returns:
- The created instance.
- Throws:
UnsupportedDrmException
- If the DRM scheme is unsupported or cannot be instantiated.
-
setOnEventListener
public void setOnEventListener(@Nullable ExoMediaDrm.OnEventListener listener)
Deprecated.Description copied from interface:ExoMediaDrm
Sets the listener for DRM events.This is an optional method, and some implementations may only support it on certain Android API levels.
- Specified by:
setOnEventListener
in interfaceExoMediaDrm
- Parameters:
listener
- The listener to receive events, ornull
to stop receiving events.- See Also:
MediaDrm.setOnEventListener(MediaDrm.OnEventListener)
-
setOnKeyStatusChangeListener
@RequiresApi(23) public void setOnKeyStatusChangeListener(@Nullable ExoMediaDrm.OnKeyStatusChangeListener listener)
Deprecated.Sets the listener for key status change events.This is an optional method, and some implementations may only support it on certain Android API levels.
- Specified by:
setOnKeyStatusChangeListener
in interfaceExoMediaDrm
- Parameters:
listener
- The listener to receive events, ornull
to stop receiving events.- Throws:
UnsupportedOperationException
- on API levels lower than 23.- See Also:
MediaDrm.setOnKeyStatusChangeListener(MediaDrm.OnKeyStatusChangeListener, Handler)
-
setOnExpirationUpdateListener
@RequiresApi(23) public void setOnExpirationUpdateListener(@Nullable ExoMediaDrm.OnExpirationUpdateListener listener)
Deprecated.Sets the listener for session expiration events.This is an optional method, and some implementations may only support it on certain Android API levels.
- Specified by:
setOnExpirationUpdateListener
in interfaceExoMediaDrm
- Parameters:
listener
- The listener to receive events, ornull
to stop receiving events.- Throws:
UnsupportedOperationException
- on API levels lower than 23.- See Also:
MediaDrm.setOnExpirationUpdateListener(MediaDrm.OnExpirationUpdateListener, Handler)
-
openSession
public byte[] openSession() throws MediaDrmException
Deprecated.Description copied from interface:ExoMediaDrm
Opens a new DRM session. A session ID is returned.- Specified by:
openSession
in interfaceExoMediaDrm
- Returns:
- The session ID.
- Throws:
NotProvisionedException
- If provisioning is needed.ResourceBusyException
- If required resources are in use.MediaDrmException
- If the session could not be opened.
-
closeSession
public void closeSession(byte[] sessionId)
Deprecated.Description copied from interface:ExoMediaDrm
Closes a DRM session.- Specified by:
closeSession
in interfaceExoMediaDrm
- Parameters:
sessionId
- The ID of the session to close.
-
setPlayerIdForSession
public void setPlayerIdForSession(byte[] sessionId, PlayerId playerId)
Deprecated.Description copied from interface:ExoMediaDrm
Sets thePlayerId
of the player using a session.- Specified by:
setPlayerIdForSession
in interfaceExoMediaDrm
- Parameters:
sessionId
- The ID of the session.playerId
- ThePlayerId
of the player using the session.
-
getKeyRequest
public ExoMediaDrm.KeyRequest getKeyRequest(byte[] scope, @Nullable List<DrmInitData.SchemeData> schemeDatas, int keyType, @Nullable HashMap<String,String> optionalParameters) throws NotProvisionedException
Deprecated.Description copied from interface:ExoMediaDrm
Generates a key request.- Specified by:
getKeyRequest
in interfaceExoMediaDrm
- Parameters:
scope
- IfkeyType
isExoMediaDrm.KEY_TYPE_STREAMING
orExoMediaDrm.KEY_TYPE_OFFLINE
, the ID of the session that the keys will be provided to. IfkeyType
isExoMediaDrm.KEY_TYPE_RELEASE
, thekeySetId
of the keys to release.schemeDatas
- If key type isExoMediaDrm.KEY_TYPE_STREAMING
orExoMediaDrm.KEY_TYPE_OFFLINE
, a list ofDrmInitData.SchemeData
instances extracted from the media. Null otherwise.keyType
- The type of the request. EitherExoMediaDrm.KEY_TYPE_STREAMING
to acquire keys for streaming,ExoMediaDrm.KEY_TYPE_OFFLINE
to acquire keys for offline usage, orExoMediaDrm.KEY_TYPE_RELEASE
to release acquired keys. Releasing keys invalidates them for all sessions.optionalParameters
- Are included in the key request message to allow a client application to provide additional message parameters to the server. This may benull
if no additional parameters are to be sent.- Returns:
- The generated key request.
- Throws:
NotProvisionedException
- See Also:
MediaDrm.getKeyRequest(byte[], byte[], String, int, HashMap)
-
provideKeyResponse
@Nullable public byte[] provideKeyResponse(byte[] scope, byte[] response) throws NotProvisionedException, DeniedByServerException
Deprecated.Description copied from interface:ExoMediaDrm
Provides a key response for the last request to be generated usingExoMediaDrm.getKeyRequest(byte[], java.util.List<com.google.android.exoplayer2.drm.DrmInitData.SchemeData>, int, java.util.HashMap<java.lang.String, java.lang.String>)
.- Specified by:
provideKeyResponse
in interfaceExoMediaDrm
- Parameters:
scope
- If the request had typeExoMediaDrm.KEY_TYPE_STREAMING
orExoMediaDrm.KEY_TYPE_OFFLINE
, the ID of the session to provide the keys to. IfkeyType
isExoMediaDrm.KEY_TYPE_RELEASE
, thekeySetId
of the keys being released.response
- The response data from the server.- Returns:
- If the request had type
ExoMediaDrm.KEY_TYPE_OFFLINE
, thekeySetId
for the offline keys. An empty byte array ornull
may be returned for other cases. - Throws:
NotProvisionedException
- If the response indicates that provisioning is needed.DeniedByServerException
- If the response indicates that the server rejected the request.
-
getProvisionRequest
public ExoMediaDrm.ProvisionRequest getProvisionRequest()
Deprecated.Description copied from interface:ExoMediaDrm
Generates a provisioning request.- Specified by:
getProvisionRequest
in interfaceExoMediaDrm
- Returns:
- The generated provisioning request.
-
provideProvisionResponse
public void provideProvisionResponse(byte[] response) throws DeniedByServerException
Deprecated.Description copied from interface:ExoMediaDrm
Provides a provisioning response for the last request to be generated usingExoMediaDrm.getProvisionRequest()
.- Specified by:
provideProvisionResponse
in interfaceExoMediaDrm
- Parameters:
response
- The response data from the server.- Throws:
DeniedByServerException
- If the response indicates that the server rejected the request.
-
queryKeyStatus
public Map<String,String> queryKeyStatus(byte[] sessionId)
Deprecated.Description copied from interface:ExoMediaDrm
Returns the key status for a given session, as {name, value} pairs. Since DRM license policies vary by vendor, the returned entries depend on the DRM plugin being used. Refer to your DRM provider's documentation for more information.- Specified by:
queryKeyStatus
in interfaceExoMediaDrm
- Parameters:
sessionId
- The ID of the session being queried.- Returns:
- The key status for the session.
-
requiresSecureDecoder
public boolean requiresSecureDecoder(byte[] sessionId, String mimeType)
Deprecated.Description copied from interface:ExoMediaDrm
Returns whether the given session requires use of a secure decoder for the given MIME type. Assumes a license policy that requires the highest level of security supported by the session.- Specified by:
requiresSecureDecoder
in interfaceExoMediaDrm
- Parameters:
sessionId
- The ID of the session.mimeType
- The content MIME type to query.
-
acquire
public void acquire()
Deprecated.Description copied from interface:ExoMediaDrm
Increments the reference count. When the caller no longer needs to use the instance, it must callExoMediaDrm.release()
to decrement the reference count.A new instance will have an initial reference count of 1, and therefore it is not normally necessary for application code to call this method.
- Specified by:
acquire
in interfaceExoMediaDrm
-
release
public void release()
Deprecated.Description copied from interface:ExoMediaDrm
Decrements the reference count. If the reference count drops to 0 underlying resources are released, and the instance cannot be re-used.- Specified by:
release
in interfaceExoMediaDrm
-
restoreKeys
public void restoreKeys(byte[] sessionId, byte[] keySetId)
Deprecated.Description copied from interface:ExoMediaDrm
Restores persisted offline keys into a session.- Specified by:
restoreKeys
in interfaceExoMediaDrm
- Parameters:
sessionId
- The ID of the session into which the keys will be restored.keySetId
- ThekeySetId
of the keys to restore, as provided by the call toExoMediaDrm.provideKeyResponse(byte[], byte[])
that persisted them.
-
getMetrics
@Nullable public PersistableBundle getMetrics()
Deprecated.Description copied from interface:ExoMediaDrm
Returns metrics data for this ExoMediaDrm instance, ornull
if metrics are unavailable.- Specified by:
getMetrics
in interfaceExoMediaDrm
-
getPropertyString
public String getPropertyString(String propertyName)
Deprecated.Description copied from interface:ExoMediaDrm
Returns the value of a string property. For standard property names, seeMediaDrm.getPropertyString(java.lang.String)
.- Specified by:
getPropertyString
in interfaceExoMediaDrm
- Parameters:
propertyName
- The property name.- Returns:
- The property value.
-
getPropertyByteArray
public byte[] getPropertyByteArray(String propertyName)
Deprecated.Description copied from interface:ExoMediaDrm
Returns the value of a byte array property. For standard property names, seeMediaDrm.getPropertyByteArray(java.lang.String)
.- Specified by:
getPropertyByteArray
in interfaceExoMediaDrm
- Parameters:
propertyName
- The property name.- Returns:
- The property value.
-
setPropertyString
public void setPropertyString(String propertyName, String value)
Deprecated.Description copied from interface:ExoMediaDrm
Sets the value of a string property.- Specified by:
setPropertyString
in interfaceExoMediaDrm
- Parameters:
propertyName
- The property name.value
- The value.
-
setPropertyByteArray
public void setPropertyByteArray(String propertyName, byte[] value)
Deprecated.Description copied from interface:ExoMediaDrm
Sets the value of a byte array property.- Specified by:
setPropertyByteArray
in interfaceExoMediaDrm
- Parameters:
propertyName
- The property name.value
- The value.
-
createCryptoConfig
public FrameworkCryptoConfig createCryptoConfig(byte[] sessionId) throws MediaCryptoException
Deprecated.Description copied from interface:ExoMediaDrm
Creates aCryptoConfig
that can be passed to a compatible decoder to allow decryption of protected content using the specified session.- Specified by:
createCryptoConfig
in interfaceExoMediaDrm
- Parameters:
sessionId
- The ID of the session.- Returns:
- A
CryptoConfig
for the given session. - Throws:
MediaCryptoException
- If aCryptoConfig
could not be created.
-
getCryptoType
public @com.google.android.exoplayer2.C.CryptoType int getCryptoType()
Deprecated.Description copied from interface:ExoMediaDrm
- Specified by:
getCryptoType
in interfaceExoMediaDrm
-
-