Search in sources :

Example 1 with DefaultDrmSessionManager

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();
}
Also used : ActionSchedule(androidx.media3.test.utils.ActionSchedule) Ignore(org.junit.Ignore) GtsTestUtil.shouldSkipWidevineTest(androidx.media3.test.exoplayer.playback.gts.GtsTestUtil.shouldSkipWidevineTest) Test(org.junit.Test)

Example 2 with DefaultDrmSessionManager

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);
}
Also used : AppManagedProvider(androidx.media3.exoplayer.drm.ExoMediaDrm.AppManagedProvider) FakeExoMediaDrm(androidx.media3.test.utils.FakeExoMediaDrm) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 AppManagedProvider (androidx.media3.exoplayer.drm.ExoMediaDrm.AppManagedProvider)1 GtsTestUtil.shouldSkipWidevineTest (androidx.media3.test.exoplayer.playback.gts.GtsTestUtil.shouldSkipWidevineTest)1 ActionSchedule (androidx.media3.test.utils.ActionSchedule)1 FakeExoMediaDrm (androidx.media3.test.utils.FakeExoMediaDrm)1 Ignore (org.junit.Ignore)1