android.media.MediaDrmException Java Examples

The following examples show how to use android.media.MediaDrmException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalDrmSessionManagerTest.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws MediaDrmException, MediaCryptoException {
    frameworkMediaCrypto = FrameworkMediaCryptoFixture.aFrameworkMediaCrypto().build();
    given(mediaDrm.openSession()).willReturn(SESSION_ID.asBytes());

    localDrmSessionManager = new LocalDrmSessionManager(
            KEY_SET_ID_TO_RESTORE,
            mediaDrm,
            DRM_SCHEME,
            handler,
            eventListener
    );
}
 
Example #2
Source File: LocalDrmSessionManagerTest.java    From no-player with Apache License 2.0 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Test
public void givenOpeningSessionError_whenAcquiringSession_thenNotifiesErrorEventListenerOnHandler() throws MediaDrmException {
    given(mediaDrm.openSession()).willThrow(new ResourceBusyException("resource is busy"));

    localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA);

    ArgumentCaptor<Runnable> argumentCaptor = ArgumentCaptor.forClass(Runnable.class);
    verify(handler).post(argumentCaptor.capture());
    argumentCaptor.getValue().run();
    verify(eventListener).onDrmSessionManagerError(any(DrmSession.DrmSessionException.class));
}
 
Example #3
Source File: LocalDrmSessionManagerTest.java    From no-player with Apache License 2.0 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Test
public void givenOpeningSessionError_whenAcquiringSession_thenReturnsInvalidDrmSession() throws MediaDrmException {
    ResourceBusyException resourceBusyException = new ResourceBusyException("resource is busy");
    given(mediaDrm.openSession()).willThrow(resourceBusyException);

    DrmSession<FrameworkMediaCrypto> drmSession = localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA);

    assertThat(drmSession).isInstanceOf(InvalidDrmSession.class);
    assertThat(drmSession.getError().getCause()).isEqualTo(resourceBusyException);
}
 
Example #4
Source File: DummyExoMediaDrm.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] openSession() throws MediaDrmException {
  throw new MediaDrmException("Attempting to open a session using a dummy ExoMediaDrm.");
}
 
Example #5
Source File: FrameworkMediaDrm.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] openSession() throws MediaDrmException {
  return mediaDrm.openSession();
}
 
Example #6
Source File: FrameworkMediaDrm.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public byte[] openSession() throws MediaDrmException {
  return mediaDrm.openSession();
}
 
Example #7
Source File: FrameworkMediaDrm.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public byte[] openSession() throws MediaDrmException {
  return mediaDrm.openSession();
}
 
Example #8
Source File: FrameworkMediaDrm.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public byte[] openSession() throws MediaDrmException {
  return mediaDrm.openSession();
}
 
Example #9
Source File: FrameworkMediaDrm.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public byte[] openSession() throws MediaDrmException {
  return mediaDrm.openSession();
}
 
Example #10
Source File: ExoMediaDrm.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * @see MediaDrm#openSession()
 */
byte[] openSession() throws MediaDrmException;
 
Example #11
Source File: ExoMediaDrm.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @see MediaDrm#openSession()
 */
byte[] openSession() throws MediaDrmException;
 
Example #12
Source File: ExoMediaDrm.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @see MediaDrm#openSession()
 */
byte[] openSession() throws MediaDrmException;
 
Example #13
Source File: ExoMediaDrm.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @see MediaDrm#openSession()
 */
byte[] openSession() throws MediaDrmException;
 
Example #14
Source File: ExoMediaDrm.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @see MediaDrm#openSession()
 */
byte[] openSession() throws MediaDrmException;