Interface MediaSession.Delegate

Enclosing class:
MediaSession

@UiThread public static interface MediaSession.Delegate
Implement this delegate to receive media session events.
  • Method Details

    • onActivated

      default void onActivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession)
      Notify that the given media session has become active. It is always the first event dispatched for a new or previously deactivated media session.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
    • onDeactivated

      default void onDeactivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession)
      Notify that the given media session has become inactive. Inactive media sessions can not be controlled.

      TODO: Add settings links to control behavior.

      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
    • onMetadata

      default void onMetadata(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.Metadata meta)
      Notify on updated metadata. Metadata may be provided by content via the DOM API or by GeckoView when not availble.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
      meta - The updated metadata.
    • onFeatures

      default void onFeatures(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, long features)
      Notify on updated supported features. Unsupported actions will have no effect.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
      features - A combination of MediaSession.Feature.
    • onPlay

      default void onPlay(@NonNull GeckoSession session, @NonNull MediaSession mediaSession)
      Notify that playback has started for the given media session.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
    • onPause

      default void onPause(@NonNull GeckoSession session, @NonNull MediaSession mediaSession)
      Notify that playback has paused for the given media session.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
    • onStop

      default void onStop(@NonNull GeckoSession session, @NonNull MediaSession mediaSession)
      Notify that playback has stopped for the given media session.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
    • onPositionState

      default void onPositionState(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.PositionState state)
      Notify on updated position state.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
      state - An instance of MediaSession.PositionState.
    • onFullscreen

      default void onFullscreen(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, boolean enabled, @Nullable MediaSession.ElementMetadata meta)
      Notify on changed fullscreen state.
      Parameters:
      session - The associated GeckoSession.
      mediaSession - The media session for the given GeckoSession.
      enabled - True when this media session in in fullscreen mode.
      meta - An instance of MediaSession.ElementMetadata, if enabled.