Package com.google.android.exoplayer2.scheduler

## Class RequirementsWatcher

- java.lang.Object
- - com.google.android.exoplayer2.scheduler.RequirementsWatcher

-     public final class RequirementsWatcher
      extends Object

  Watches whether the `Requirements` are met and notifies the `RequirementsWatcher.Listener` on changes.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `RequirementsWatcher.Listener` | Notified when RequirementsWatcher instance first created and on changes whether the `Requirements` are met.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RequirementsWatcher​(Context context, RequirementsWatcher.Listener listener, Requirements requirements)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Requirements` | `getRequirements()` | Returns watched `Requirements`.
    `@com.google.android.exoplayer2.scheduler.Requirements.RequirementFlags int` | `start()` | Starts watching for changes.
    `void` | `stop()` | Stops watching for changes.

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

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

- - ### Constructor Detail

    - #### RequirementsWatcher

          public RequirementsWatcher​(Context context,
                                     RequirementsWatcher.Listener listener,
                                     Requirements requirements)

      Parameters:
        `context` - Any context.
        `listener` - Notified whether the `Requirements` are met.
        `requirements` - The requirements to watch.

  - ### Method Detail

    - #### start

          @RequirementFlags
          public @com.google.android.exoplayer2.scheduler.Requirements.RequirementFlags int start()

      Starts watching for changes. Must be called from a thread that has an associated `Looper`. Listener methods are called on the caller thread.
      Returns:
        Initial `RequirementFlags` that are not met, or 0.

    - #### stop

          public void stop()

      Stops watching for changes.

    - #### getRequirements

          public Requirements getRequirements()

      Returns watched `Requirements`.