Package com.google.android.exoplayer2.util

## Class DebugTextViewHelper

- java.lang.Object
- - com.google.android.exoplayer2.util.DebugTextViewHelper

- All Implemented Interfaces:
    `AudioListener`, `DeviceListener`, `MetadataOutput`, `Player.EventListener`, `Player.Listener`, `TextOutput`, `VideoListener`, `Runnable`

      public class DebugTextViewHelper
      extends Object
      implements Player.Listener, Runnable

  A helper class for periodically updating a `TextView` with debug information obtained from a `SimpleExoPlayer`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DebugTextViewHelper​(SimpleExoPlayer player, TextView textView)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected String` | `getAudioString()` | Returns a string containing audio debugging information.
    `protected String` | `getDebugString()` | Returns the debugging information string to be shown by the target `TextView`.
    `protected String` | `getPlayerStateString()` | Returns a string containing player state debugging information.
    `protected String` | `getVideoString()` | Returns a string containing video debugging information.
    `void` | `onPlaybackStateChanged​(int playbackState)` | Called when the value returned from `Player.getPlaybackState()` changes.
    `void` | `onPlayWhenReadyChanged​(boolean playWhenReady, int playbackState)` | Called when the value returned from `Player.getPlayWhenReady()` changes.
    `void` | `onPositionDiscontinuity​(Player.PositionInfo oldPosition, Player.PositionInfo newPosition, int reason)` | Called when a position discontinuity occurs.
    `void` | `run()` |
    `void` | `start()` | Starts periodic updates of the `TextView`.
    `void` | `stop()` | Stops periodic updates of the `TextView`.
    `protected void` | `updateAndPost()` |

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface com.google.android.exoplayer2.audio.AudioListener

      `onAudioAttributesChanged, onAudioSessionIdChanged, onSkipSilenceEnabledChanged, onVolumeChanged`

    - ### Methods inherited from interface com.google.android.exoplayer2.device.DeviceListener

      `onDeviceInfoChanged, onDeviceVolumeChanged`

    - ### Methods inherited from interface com.google.android.exoplayer2.Player.EventListener

      `onAvailableCommandsChanged, onEvents, onIsLoadingChanged, onIsPlayingChanged, onLoadingChanged, onMediaItemTransition, onMediaMetadataChanged, onPlaybackParametersChanged, onPlaybackSuppressionReasonChanged, onPlayerError, onPlayerStateChanged, onPositionDiscontinuity, onRepeatModeChanged, onSeekProcessed, onShuffleModeEnabledChanged, onStaticMetadataChanged, onTimelineChanged, onTimelineChanged, onTracksChanged`

    - ### Methods inherited from interface com.google.android.exoplayer2.Player.Listener

      `onCues, onMetadata`

    - ### Methods inherited from interface com.google.android.exoplayer2.video.VideoListener

      `onRenderedFirstFrame, onSurfaceSizeChanged, onVideoSizeChanged, onVideoSizeChanged`

- - ### Constructor Detail

    - #### DebugTextViewHelper

          public DebugTextViewHelper​(SimpleExoPlayer player,
                                     TextView textView)

      Parameters:
        `player` - The `SimpleExoPlayer` from which debug information should be obtained. Only players which are accessed on the main thread are supported (`player.getApplicationLooper() == Looper.getMainLooper()`).
        `textView` - The `TextView` that should be updated to display the information.

  - ### Method Detail

    - #### start

          public final void start()

      Starts periodic updates of the `TextView`. Must be called from the application's main thread.

    - #### stop

          public final void stop()

      Stops periodic updates of the `TextView`. Must be called from the application's main thread.

    - #### onPlaybackStateChanged

          public final void onPlaybackStateChanged​(@State
                                                   int playbackState)

      Description copied from interface: `Player.EventListener`
      Called when the value returned from `Player.getPlaybackState()` changes.

      `Player.EventListener.onEvents(Player, Events)` will also be called to report this event along with other events that happen in the same `Looper` message queue iteration.

      Specified by:
        `onPlaybackStateChanged` in interface `Player.EventListener`
      Parameters:
        `playbackState` - The new playback `state`.

    - #### onPlayWhenReadyChanged

          public final void onPlayWhenReadyChanged​(boolean playWhenReady,
                                                   @PlayWhenReadyChangeReason
                                                   int playbackState)

      Description copied from interface: `Player.EventListener`
      Called when the value returned from `Player.getPlayWhenReady()` changes.

      `Player.EventListener.onEvents(Player, Events)` will also be called to report this event along with other events that happen in the same `Looper` message queue iteration.

      Specified by:
        `onPlayWhenReadyChanged` in interface `Player.EventListener`
      Parameters:
        `playWhenReady` - Whether playback will proceed when ready.
        `playbackState` - The `reason` for the change.

    - #### onPositionDiscontinuity

          public final void onPositionDiscontinuity​(Player.PositionInfo oldPosition,
                                                    Player.PositionInfo newPosition,
                                                    @DiscontinuityReason
                                                    int reason)

      Description copied from interface: `Player.EventListener`
      Called when a position discontinuity occurs.

      A position discontinuity occurs when the playing period changes, the playback position jumps within the period currently being played, or when the playing period has been skipped or removed.

      `Player.EventListener.onEvents(Player, Events)` will also be called to report this event along with other events that happen in the same `Looper` message queue iteration.

      Specified by:
        `onPositionDiscontinuity` in interface `Player.EventListener`
      Parameters:
        `oldPosition` - The position before the discontinuity.
        `newPosition` - The position after the discontinuity.
        `reason` - The `Player.DiscontinuityReason` responsible for the discontinuity.

    - #### run

          public final void run()

      Specified by:
        `run` in interface `Runnable`

    - #### updateAndPost

          protected final void updateAndPost()

    - #### getDebugString

          protected String getDebugString()

      Returns the debugging information string to be shown by the target `TextView`.

    - #### getPlayerStateString

          protected String getPlayerStateString()

      Returns a string containing player state debugging information.

    - #### getVideoString

          protected String getVideoString()

      Returns a string containing video debugging information.

    - #### getAudioString

          protected String getAudioString()

      Returns a string containing audio debugging information.