Package com.google.android.exoplayer2.ui

## Class DebugTextViewHelper

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

- All Implemented Interfaces:
    `Player.EventListener`, `Runnable`

      public class DebugTextViewHelper
      extends Object
      implements Player.EventListener, 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​(int reason)` | Called when a position discontinuity occurs without a change to the timeline.
    `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.Player.EventListener

      `onEvents, onExperimentalOffloadSchedulingEnabledChanged, onExperimentalSleepingForOffloadChanged, onIsLoadingChanged, onIsPlayingChanged, onLoadingChanged, onMediaItemTransition, onPlaybackParametersChanged, onPlaybackSuppressionReasonChanged, onPlayerError, onPlayerStateChanged, onRepeatModeChanged, onSeekProcessed, onShuffleModeEnabledChanged, onStaticMetadataChanged, onTimelineChanged, onTimelineChanged, onTracksChanged`

- - ### 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​(@DiscontinuityReason
                                                    int reason)

      Description copied from interface: `Player.EventListener`
      Called when a position discontinuity occurs without a change to the timeline. A position discontinuity occurs when the current window or period index changes (as a result of playback transitioning from one period in the timeline to the next), or when the playback position jumps within the period currently being played (as a result of a seek being performed, or when the source introduces a discontinuity internally).

      When a position discontinuity occurs as a result of a change to the timeline this method is not called. `Player.EventListener.onTimelineChanged(Timeline, int)` is called in this case.

      `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:
        `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.