/** * 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); }
@Before public void setUp() throws DrmSessionCreatorException { given(drmSessionCreatorFactory.createFor(any(DrmType.class), any(DrmHandler.class))).willReturn(drmSessionCreator); given(noPlayerExoPlayerCreator.createExoPlayer(context, drmSessionCreator, USE_SECURE_CODEC)).willReturn(EXO_PLAYER); given(noPlayerMediaPlayerCreator.createMediaPlayer(context)).willReturn(MEDIA_PLAYER); noPlayerCreator = new NoPlayerCreator(context, prioritizedPlayerTypes(), noPlayerExoPlayerCreator, noPlayerMediaPlayerCreator, drmSessionCreatorFactory); }