Package org.mozilla.geckoview
Interface MediaSession.Delegate
- Enclosing class:
- MediaSession
@UiThread
public static interface MediaSession.Delegate
Implement this delegate to receive media session events.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
onActivated
(GeckoSession session, MediaSession mediaSession) Notify that the given media session has become active.default void
onDeactivated
(GeckoSession session, MediaSession mediaSession) Notify that the given media session has become inactive.default void
onFeatures
(GeckoSession session, MediaSession mediaSession, long features) Notify on updated supported features.default void
onFullscreen
(GeckoSession session, MediaSession mediaSession, boolean enabled, MediaSession.ElementMetadata meta) Notify on changed fullscreen state.default void
onMetadata
(GeckoSession session, MediaSession mediaSession, MediaSession.Metadata meta) Notify on updated metadata.default void
onPause
(GeckoSession session, MediaSession mediaSession) Notify that playback has paused for the given media session.default void
onPlay
(GeckoSession session, MediaSession mediaSession) Notify that playback has started for the given media session.default void
onPositionState
(GeckoSession session, MediaSession mediaSession, MediaSession.PositionState state) Notify on updated position state.default void
onStop
(GeckoSession session, MediaSession mediaSession) Notify that playback has stopped for the given media session.
-
Method Details
-
onActivated
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
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 ofMediaSession.Feature
.
-
onPlay
Notify that playback has started for the given media session.- Parameters:
session
- The associated GeckoSession.mediaSession
- The media session for the given GeckoSession.
-
onPause
Notify that playback has paused for the given media session.- Parameters:
session
- The associated GeckoSession.mediaSession
- The media session for the given GeckoSession.
-
onStop
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 ofMediaSession.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 ofMediaSession.ElementMetadata
, if enabled.
-