Extend documentation for ForwardingPlayer

Add some additional information which methods to override
for available commands.

#minor-release

PiperOrigin-RevId: 513251805
This commit is contained in:
christosts 2023-03-01 17:04:06 +00:00 committed by tonihei
parent d2d9168f9d
commit a64a9e67ca

View File

@ -225,14 +225,20 @@ the following:
When overriding `ForwardingPlayer` methods it's important to ensure the When overriding `ForwardingPlayer` methods it's important to ensure the
implementation remains self-consistent and compliant with the `Player` implementation remains self-consistent and compliant with the `Player`
interface, especially when dealing with methods that are intended to have interface, especially when dealing with methods that are intended to have
identical or related behavior. For example, if you want to override every 'play' identical or related behavior. For example:
operation, you need to override both `ForwardingPlayer.play` and * If you want to override every 'play' operation, you need to override both
`ForwardingPlayer.setPlayWhenReady`, because a caller will expect the behavior `ForwardingPlayer.play` and `ForwardingPlayer.setPlayWhenReady`, because a
of these methdods to be identical when `playWhenReady = true`. Similarly, if you caller will expect the behavior of these methods to be identical when
want to change the seek-forward increment you need to override both `playWhenReady = true`.
`ForwardingPlayer.seekForward` to perform a seek with your customized increment, * If you want to change the seek-forward increment you need to override both
and `ForwardingPlayer.getSeekForwardIncrement` in order to report the correct `ForwardingPlayer.seekForward` to perform a seek with your customized
customized increment back to the caller. increment, and `ForwardingPlayer.getSeekForwardIncrement` in order to report
the correct customized increment back to the caller.
* If you want to control what `Player.Commands` are advertised by a player
instance, you must override `Player.getAvailableCommands()`,
`Player.isCommandAvailable()` and also listen to the
`Player.Listener.onAvailableCommandsChanged()` callback to get notified of
changes coming from the underlying player.
## MediaSource customization ## ## MediaSource customization ##