use of androidx.media3.exoplayer.drm.DefaultDrmSessionManager in project media by androidx.
the class DashWidevineOfflineTest method widevineOfflineLicenseExpiresOnPauseV22.
@Test
@Ignore("Needs to be reconfigured/rewritten with an offline-compatible licence [internal" + " b/176960595].")
public void widevineOfflineLicenseExpiresOnPauseV22() throws Exception {
assumeTrue(Util.SDK_INT >= 22);
downloadLicense();
// During playback pause until the license expires then continue playback
Pair<Long, Long> licenseDurationRemainingSec = offlineLicenseHelper.getLicenseDurationRemainingSec(offlineLicenseKeySetId);
long licenseDuration = licenseDurationRemainingSec.first;
assertWithMessage("License duration should be less than 30 sec. Server settings might have changed.").that(licenseDuration).isLessThan(30);
ActionSchedule schedule = new ActionSchedule.Builder(TAG).waitForPlaybackState(Player.STATE_READY).delay(3000).pause().delay(licenseDuration * 1000 + 2000).play().build();
// DefaultDrmSessionManager should renew the license and stream play fine
testRunner.setActionSchedule(schedule).run();
}
use of androidx.media3.exoplayer.drm.DefaultDrmSessionManager in project media by androidx.
the class DefaultDrmSessionManagerTest method provisioningUndoneWhileManagerIsActive_deviceReprovisioned.
@Test
public void provisioningUndoneWhileManagerIsActive_deviceReprovisioned() {
FakeExoMediaDrm.LicenseServer licenseServer = FakeExoMediaDrm.LicenseServer.allowingSchemeDatas(DRM_SCHEME_DATAS);
FakeExoMediaDrm mediaDrm = new FakeExoMediaDrm.Builder().setProvisionsRequired(2).build();
DefaultDrmSessionManager drmSessionManager = new DefaultDrmSessionManager.Builder().setUuidAndExoMediaDrmProvider(DRM_SCHEME_UUID, new AppManagedProvider(mediaDrm)).setSessionKeepaliveMs(C.TIME_UNSET).build(/* mediaDrmCallback= */
licenseServer);
drmSessionManager.prepare();
drmSessionManager.setPlayer(/* playbackLooper= */
Looper.myLooper(), PlayerId.UNSET);
DrmSession drmSession = checkNotNull(drmSessionManager.acquireSession(/* eventDispatcher= */
null, FORMAT_WITH_DRM_INIT_DATA));
// Confirm that opening the session threw NotProvisionedException (otherwise state would be
// OPENED)
assertThat(drmSession.getState()).isEqualTo(DrmSession.STATE_OPENING);
waitForOpenedWithKeys(drmSession);
drmSession.release(/* eventDispatcher= */
null);
mediaDrm.resetProvisioning();
drmSession = checkNotNull(drmSessionManager.acquireSession(/* eventDispatcher= */
null, FORMAT_WITH_DRM_INIT_DATA));
// Confirm that opening the session threw NotProvisionedException (otherwise state would be
// OPENED)
assertThat(drmSession.getState()).isEqualTo(DrmSession.STATE_OPENING);
waitForOpenedWithKeys(drmSession);
assertThat(licenseServer.getReceivedProvisionRequests()).hasSize(4);
}
Aggregations