本文整理汇总了Java中android.media.MediaDrmException类的典型用法代码示例。如果您正苦于以下问题:Java MediaDrmException类的具体用法?Java MediaDrmException怎么用?Java MediaDrmException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaDrmException类属于android.media包,在下文中一共展示了MediaDrmException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import android.media.MediaDrmException; //导入依赖的package包/类
@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
);
}
示例2: givenOpeningSessionError_whenAcquiringSession_thenNotifiesErrorEventListenerOnHandler
import android.media.MediaDrmException; //导入依赖的package包/类
@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));
}
示例3: givenOpeningSessionError_whenAcquiringSession_thenReturnsInvalidDrmSession
import android.media.MediaDrmException; //导入依赖的package包/类
@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);
}
示例4: openSession
import android.media.MediaDrmException; //导入依赖的package包/类
@Override
public byte[] openSession() throws MediaDrmException {
return mediaDrm.openSession();
}
示例5: open
import android.media.MediaDrmException; //导入依赖的package包/类
static MediaDrmSession open(@NonNull MediaDrm mediaDrm) throws MediaDrmException {
MediaDrmSession session = new MediaDrmSession(mediaDrm);
session.mSessionId = mediaDrm.openSession();
return session;
}
示例6: openSessionWithKeys
import android.media.MediaDrmException; //导入依赖的package包/类
static MediaDrmSession openSessionWithKeys(MediaDrm mediaDrm, OfflineKeySetStorage storage, byte[] initData) throws MediaDrmException, MediaCryptoException, FileNotFoundException {
byte[] keySetId = storage.loadKeySetId(initData);
MediaDrmSession session = MediaDrmSession.open(mediaDrm);
session.restoreKeys(keySetId);
Map<String, String> keyStatus = session.queryKeyStatus();
Log.d(TAG, "keyStatus: " + keyStatus);
return session;
}
示例7: openSession
import android.media.MediaDrmException; //导入依赖的package包/类
/**
* @see MediaDrm#openSession()
*/
byte[] openSession() throws MediaDrmException;