Document ExoMediaDrm listener methods as optional
Also document FrameworkMediaDrm overrides as dependent on API level. These two methods call through to equivalent methods on MediaDrm that were added in 23: https://developer.android.com/reference/android/media/MediaDrm#setOnExpirationUpdateListener(java.util.concurrent.Executor,%20android.media.MediaDrm.OnExpirationUpdateListener) PiperOrigin-RevId: 303102370
This commit is contained in:
parent
b314da5f02
commit
47d5dd911c
@ -224,13 +224,40 @@ public interface ExoMediaDrm {
|
||||
|
||||
}
|
||||
|
||||
/** @see MediaDrm#setOnEventListener(MediaDrm.OnEventListener) */
|
||||
/**
|
||||
* Sets the listener for DRM events.
|
||||
*
|
||||
* <p>This is an optional method, and some implementations may only support it on certain Android
|
||||
* API levels.
|
||||
*
|
||||
* @param listener The listener to receive events, or {@code null} to stop receiving events.
|
||||
* @throws UnsupportedOperationException if the implementation doesn't support this method.
|
||||
* @see MediaDrm#setOnEventListener(MediaDrm.OnEventListener)
|
||||
*/
|
||||
void setOnEventListener(@Nullable OnEventListener listener);
|
||||
|
||||
/** @see MediaDrm#setOnKeyStatusChangeListener(MediaDrm.OnKeyStatusChangeListener, Handler) */
|
||||
/**
|
||||
* Sets the listener for key status change events.
|
||||
*
|
||||
* <p>This is an optional method, and some implementations may only support it on certain Android
|
||||
* API levels.
|
||||
*
|
||||
* @param listener The listener to receive events, or {@code null} to stop receiving events.
|
||||
* @throws UnsupportedOperationException if the implementation doesn't support this method.
|
||||
* @see MediaDrm#setOnKeyStatusChangeListener(MediaDrm.OnKeyStatusChangeListener, Handler)
|
||||
*/
|
||||
void setOnKeyStatusChangeListener(@Nullable OnKeyStatusChangeListener listener);
|
||||
|
||||
/** @see MediaDrm#setOnExpirationUpdateListener(MediaDrm.OnExpirationUpdateListener, Handler) */
|
||||
/**
|
||||
* Sets the listener for session expiration events.
|
||||
*
|
||||
* <p>This is an optional method, and some implementations may only support it on certain Android
|
||||
* API levels.
|
||||
*
|
||||
* @param listener The listener to receive events, or {@code null} to stop receiving events.
|
||||
* @throws UnsupportedOperationException if the implementation doesn't support this method.
|
||||
* @see MediaDrm#setOnExpirationUpdateListener(MediaDrm.OnExpirationUpdateListener, Handler)
|
||||
*/
|
||||
void setOnExpirationUpdateListener(@Nullable OnExpirationUpdateListener listener);
|
||||
|
||||
/** @see MediaDrm#openSession() */
|
||||
|
@ -114,7 +114,14 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
listener.onEvent(FrameworkMediaDrm.this, sessionId, event, extra, data));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param listener The listener to receive events, or {@code null} to stop receiving events.
|
||||
* @throws UnsupportedOperationException on API levels lower than 23.
|
||||
*/
|
||||
@Override
|
||||
@RequiresApi(23)
|
||||
public void setOnKeyStatusChangeListener(
|
||||
@Nullable ExoMediaDrm.OnKeyStatusChangeListener listener) {
|
||||
if (Util.SDK_INT < 23) {
|
||||
@ -135,7 +142,14 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
/* handler= */ null);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param listener The listener to receive events, or {@code null} to stop receiving events.
|
||||
* @throws UnsupportedOperationException on API levels lower than 23.
|
||||
*/
|
||||
@Override
|
||||
@RequiresApi(23)
|
||||
public void setOnExpirationUpdateListener(@Nullable OnExpirationUpdateListener listener) {
|
||||
if (Util.SDK_INT < 23) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
Loading…
x
Reference in New Issue
Block a user