Tabnine Logo
LocalDrmSessionManager
Code IndexAdd Tabnine to your IDE (free)

How to use
LocalDrmSessionManager
in
com.novoda.noplayer.internal.exoplayer.drm

Best Java code snippets using com.novoda.noplayer.internal.exoplayer.drm.LocalDrmSessionManager (Showing top 10 results out of 315)

origin: novoda/no-player

  @Override
  public DrmSessionManager<FrameworkMediaCrypto> create(DefaultDrmSessionEventListener eventListener) {
    return new LocalDrmSessionManager(
        downloadedModularDrm.getKeySetId(),
        mediaDrmCreator.create(WIDEVINE_MODULAR_UUID),
        WIDEVINE_MODULAR_UUID,
        handler,
        eventListener
    );
  }
}
origin: novoda/no-player

@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));
}
origin: novoda/no-player

@Test
public void givenDrmDataDoesNotContainDrmScheme_whenCheckingCanAcquireSession_thenReturnsFalse() {
  DrmInitData.SchemeData unrecognisedSchemeData = new DrmInitData.SchemeData(
      UUID.randomUUID(), "ANY_MIME_TYPE", new byte[]{}
  );
  DrmInitData drmInitData = new DrmInitData(Collections.singletonList(unrecognisedSchemeData));
  boolean canAcquireSession = localDrmSessionManager.canAcquireSession(drmInitData);
  assertThat(canAcquireSession).isFalse();
}
origin: novoda/no-player

  @Test
  public void givenAcquiredSession_whenReleasingSession_thenClosesCurrentSession() {
    DrmSession<FrameworkMediaCrypto> drmSession = new LocalDrmSession(frameworkMediaCrypto, KEY_SET_ID_TO_RESTORE, SESSION_ID);

    localDrmSessionManager.releaseSession(drmSession);

    verify(mediaDrm).closeSession(SESSION_ID.asBytes());
  }
}
origin: novoda/no-player

@SuppressWarnings("PMD.AvoidCatchingGenericException") // We are forced to catch Exception as ResourceBusyException is minSdk 19
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@Override
public DrmSession<FrameworkMediaCrypto> acquireSession(Looper playbackLooper, DrmInitData drmInitData) {
  DrmSession<FrameworkMediaCrypto> drmSession;
  try {
    SessionId sessionId = SessionId.of(mediaDrm.openSession());
    FrameworkMediaCrypto mediaCrypto = mediaDrm.createMediaCrypto(sessionId.asBytes());
    mediaDrm.restoreKeys(sessionId.asBytes(), keySetIdToRestore.asBytes());
    drmSession = new LocalDrmSession(mediaCrypto, keySetIdToRestore, sessionId);
  } catch (Exception exception) {
    drmSession = new InvalidDrmSession(new DrmSession.DrmSessionException(exception));
    notifyErrorListener(drmSession);
  }
  return drmSession;
}
origin: novoda/no-player

@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
  );
}
origin: novoda/no-player

@Test
public void givenValidMediaDrm_whenAcquiringSession_thenRestoresKeys() throws MediaCryptoException {
  given(mediaDrm.createMediaCrypto(SESSION_ID.asBytes())).willReturn(frameworkMediaCrypto);
  localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA);
  verify(mediaDrm).restoreKeys(SESSION_ID.asBytes(), KEY_SET_ID_TO_RESTORE.asBytes());
}
origin: novoda/no-player

@Test
public void givenDrmDataContainsDrmScheme_whenCheckingCanAcquireSession_thenReturnsTrue() {
  DrmInitData.SchemeData recognisedSchemeData = new DrmInitData.SchemeData(
      DRM_SCHEME, "ANY_MIME_TYPE", new byte[]{}
  );
  DrmInitData drmInitData = new DrmInitData(Collections.singletonList(recognisedSchemeData));
  boolean canAcquireSession = localDrmSessionManager.canAcquireSession(drmInitData);
  assertThat(canAcquireSession).isTrue();
}
origin: novoda/no-player

@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);
}
origin: novoda/no-player

@Test
public void givenValidMediaDrm_whenAcquiringSession_thenReturnsLocalDrmSession() throws MediaCryptoException {
  given(mediaDrm.createMediaCrypto(SESSION_ID.asBytes())).willReturn(frameworkMediaCrypto);
  DrmSession<FrameworkMediaCrypto> drmSession = localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA);
  LocalDrmSession localDrmSession = new LocalDrmSession(frameworkMediaCrypto, KEY_SET_ID_TO_RESTORE, SESSION_ID);
  assertThat(drmSession).isEqualTo(localDrmSession);
}
com.novoda.noplayer.internal.exoplayer.drmLocalDrmSessionManager

Most used methods

  • <init>
  • acquireSession
  • canAcquireSession
  • notifyErrorListener
  • releaseSession

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getContentResolver (Context)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now