Skip to content

Commit

Permalink
Extend documentation for ForwardingPlayer
Browse files Browse the repository at this point in the history
Add some additional information which methods to override
for available commands.

#minor-release

PiperOrigin-RevId: 513251805
  • Loading branch information
christosts authored and tonihei committed Mar 1, 2023
1 parent d2d9168 commit a64a9e6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,20 @@ the following:
When overriding `ForwardingPlayer` methods it's important to ensure the
implementation remains self-consistent and compliant with the `Player`
interface, especially when dealing with methods that are intended to have
identical or related behavior. For example, if you want to override every 'play'
operation, you need to override both `ForwardingPlayer.play` and
`ForwardingPlayer.setPlayWhenReady`, because a caller will expect the behavior
of these methdods to be identical when `playWhenReady = true`. Similarly, if you
want to change the seek-forward increment you need to override both
`ForwardingPlayer.seekForward` to perform a seek with your customized increment,
and `ForwardingPlayer.getSeekForwardIncrement` in order to report the correct
customized increment back to the caller.
identical or related behavior. For example:
* If you want to override every 'play' operation, you need to override both
`ForwardingPlayer.play` and `ForwardingPlayer.setPlayWhenReady`, because a
caller will expect the behavior of these methods to be identical when
`playWhenReady = true`.
* If you want to change the seek-forward increment you need to override both
`ForwardingPlayer.seekForward` to perform a seek with your customized
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 ##

Expand Down

0 comments on commit a64a9e6

Please sign in to comment.