From d5ae16c0c914b959c2bf2fe3f7085984f7bb4657 Mon Sep 17 00:00:00 2001 From: christosts Date: Wed, 1 Mar 2023 17:04:06 +0000 Subject: [PATCH] Extend documentation for ForwardingPlayer Add some additional information which methods to override for available commands. #minor-release PiperOrigin-RevId: 513251805 (cherry picked from commit a64a9e67ca3bf34f29e525b1bdfbb73371a66ae7) --- docs/customization.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/customization.md b/docs/customization.md index 28446dacbd4..1c41162be3c 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -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 ##