Back to Exoplayer

FakeExoMediaDrm.Builder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/FakeExoMediaDrm.Builder.html

latest6.4 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class FakeExoMediaDrm.Builder


public static classFakeExoMediaDrm.Builderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Builder for FakeExoMediaDrm instances.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Builder() | Constructs an instance. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | FakeExoMediaDrm | build() | Returns a FakeExoMediaDrm instance with an initial reference count of 1. | | FakeExoMediaDrm.Builder | setEnforceValidKeyResponses​(boolean enforceValidKeyResponses) | Sets whether key responses passed to FakeExoMediaDrm.provideKeyResponse(byte[], byte[]) should be checked for validity (i.e. | | FakeExoMediaDrm.Builder | setMaxConcurrentSessions​(int maxConcurrentSessions) | Sets the maximum number of concurrent sessions the FakeExoMediaDrm will support. | | FakeExoMediaDrm.Builder | setProvisionsRequired​(int provisionsRequired) | Sets how many successful provisioning round trips are needed for the FakeExoMediaDrm to be provisioned. | | FakeExoMediaDrm.Builder | throwNotProvisionedExceptionFromGetKeyRequest() | Configures the FakeExoMediaDrm to throw any NotProvisionedException from FakeExoMediaDrm.getKeyRequest(byte[], List, int, HashMap) instead of the default behaviour of throwing from FakeExoMediaDrm.openSession(). |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

Builder

public Builder()

Constructs an instance.

Method Detail

- 

setEnforceValidKeyResponses

@CanIgnoreReturnValue
public[FakeExoMediaDrm.Builder](FakeExoMediaDrm.Builder.html "class in com.google.android.exoplayer2.testutil")setEnforceValidKeyResponses​(boolean enforceValidKeyResponses)

Sets whether key responses passed to FakeExoMediaDrm.provideKeyResponse(byte[], byte[]) should be checked for validity (i.e. that they came from a FakeExoMediaDrm.LicenseServer).

Defaults to true.

- 

setProvisionsRequired

@CanIgnoreReturnValue
public[FakeExoMediaDrm.Builder](FakeExoMediaDrm.Builder.html "class in com.google.android.exoplayer2.testutil")setProvisionsRequired​(int provisionsRequired)

Sets how many successful provisioning round trips are needed for the FakeExoMediaDrm to be provisioned.

An unprovisioned FakeExoMediaDrm will throw NotProvisionedException from methods that declare it until enough valid provisioning responses are passed to FakeExoMediaDrm.provideProvisionResponse(byte[]).

Defaults to 0 (i.e. device is already provisioned).

- 

throwNotProvisionedExceptionFromGetKeyRequest

@CanIgnoreReturnValue
public[FakeExoMediaDrm.Builder](FakeExoMediaDrm.Builder.html "class in com.google.android.exoplayer2.testutil")throwNotProvisionedExceptionFromGetKeyRequest()

Configures the FakeExoMediaDrm to throw any NotProvisionedException from FakeExoMediaDrm.getKeyRequest(byte[], List, int, HashMap) instead of the default behaviour of throwing from FakeExoMediaDrm.openSession().

- 

setMaxConcurrentSessions

@CanIgnoreReturnValue
public[FakeExoMediaDrm.Builder](FakeExoMediaDrm.Builder.html "class in com.google.android.exoplayer2.testutil")setMaxConcurrentSessions​(int maxConcurrentSessions)

Sets the maximum number of concurrent sessions the FakeExoMediaDrm will support.

If this is exceeded then subsequent calls to FakeExoMediaDrm.openSession() will throw ResourceBusyException.

Defaults to Integer.MAX_VALUE.

- 

build

public[FakeExoMediaDrm](FakeExoMediaDrm.html "class in com.google.android.exoplayer2.testutil")build()

Returns a FakeExoMediaDrm instance with an initial reference count of 1. The caller is responsible for calling FakeExoMediaDrm.release() when they no longer need the instance.