@Before public void setUp() { drmSessionCreatorFactory = new DrmSessionCreatorFactory(SUPPORTED_MEDIA_DRM_DEVICE, provisionExecutorCreator, handler); }
/** * Builds a new {@link NoPlayer} instance. * * @param context The {@link Context} associated with the player. * @return a {@link NoPlayer} instance. * @throws UnableToCreatePlayerException thrown when the configuration is not supported and there is no way to recover. * @see NoPlayer */ public NoPlayer build(Context context) throws UnableToCreatePlayerException { Context applicationContext = context.getApplicationContext(); Handler handler = new Handler(Looper.getMainLooper()); ProvisionExecutorCreator provisionExecutorCreator = new ProvisionExecutorCreator(); DrmSessionCreatorFactory drmSessionCreatorFactory = new DrmSessionCreatorFactory( AndroidDeviceVersion.newInstance(), provisionExecutorCreator, handler ); NoPlayerCreator noPlayerCreator = new NoPlayerCreator( applicationContext, prioritizedPlayerTypes, NoPlayerExoPlayerCreator.newInstance(handler), NoPlayerMediaPlayerCreator.newInstance(handler), drmSessionCreatorFactory ); return noPlayerCreator.create(drmType, drmHandler, downgradeSecureDecoder); }
@Test public void givenDrmTypeWidevineModularStream_andAndroidVersionDoesNotSupportMediaDrmApis_whenCreatingDrmSessionCreator_thenThrowsUnableToCreatePlayerException() throws DrmSessionCreatorException { drmSessionCreatorFactory = new DrmSessionCreatorFactory(UNSUPPORTED_MEDIA_DRM_DEVICE_VERSION, provisionExecutorCreator, handler); String message = "Device must be target: 18 but was: 17 for DRM type: WIDEVINE_MODULAR_STREAM"; thrown.expect(ExceptionMatcher.matches(message, UnableToCreatePlayerException.class)); drmSessionCreatorFactory.createFor(DrmType.WIDEVINE_MODULAR_STREAM, IGNORED_DRM_HANDLER); }
@Test public void givenDrmTypeWidevineDownloadStream_andAndroidVersionDoesNotSupportMediaDrmApis_whenCreatingDrmSessionCreator_thenThrowsUnableToCreatePlayerException() throws DrmSessionCreatorException { drmSessionCreatorFactory = new DrmSessionCreatorFactory(UNSUPPORTED_MEDIA_DRM_DEVICE_VERSION, provisionExecutorCreator, handler); String message = "Device must be target: 18 but was: 17 for DRM type: WIDEVINE_MODULAR_DOWNLOAD"; thrown.expect(ExceptionMatcher.matches(message, UnableToCreatePlayerException.class)); drmSessionCreatorFactory.createFor(DrmType.WIDEVINE_MODULAR_DOWNLOAD, IGNORED_DRM_HANDLER); } }