CastPlayer.Builder


public final class CastPlayer.Builder


Builder for CastPlayer.

Summary

Public constructors

Builder(Context context)

Creates a builder.

Public methods

CastPlayer

Creates and returns the new CastPlayerImpl instance.

CastPlayer.Builder

Sets the Player to use for local playback.

CastPlayer.Builder

Sets the RemoteCastPlayer to use for remote playback.

CastPlayer.Builder

Sets the TransferCallback to call when the active player changes.

Public constructors

Builder

public Builder(Context context)

Creates a builder.

The builder uses the following default values:

Parameters
Context context

A Context.

Public methods

build

public CastPlayer build()

Creates and returns the new CastPlayerImpl instance.

Throws
java.lang.IllegalStateException

If this method has already been called on this instance.

setLocalPlayer

@CanIgnoreReturnValue
public CastPlayer.Builder setLocalPlayer(Player localPlayer)

Sets the Player to use for local playback.

Parameters
Player localPlayer

A Player.

Returns
CastPlayer.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called on this builder instance.

setRemotePlayer

@CanIgnoreReturnValue
public CastPlayer.Builder setRemotePlayer(RemoteCastPlayer remotePlayer)

Sets the RemoteCastPlayer to use for remote playback.

Parameters
RemoteCastPlayer remotePlayer

A RemoteCastPlayer.

Returns
CastPlayer.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called on this builder instance.

setTransferCallback

@CanIgnoreReturnValue
public CastPlayer.Builder setTransferCallback(CastPlayer.TransferCallback transferCallback)

Sets the TransferCallback to call when the active player changes.

Parameters
CastPlayer.TransferCallback transferCallback

A TransferCallback.

Returns
CastPlayer.Builder

This builder.

Throws
java.lang.IllegalStateException

If build has already been called on this builder instance.