jaewan 25c26cdbb4 Return state masked Player values from SessionPlayerConnector
Before this CL, SessionPlayerConnector getters had returned
UNKNOWN_TIME in idle state. It was because
SessionPlayerConnector had followed AndroidX media2
MediaPlayer's behavior, which was the baseline code of the
SessionPlayerConnector.

With this CL, SessionPlayerConnector getters directly return
underlying Player's value, rather than considering calls
in IDLE state as an exception and fallbacks to the default
UNKNOWN_TIME.

PiperOrigin-RevId: 327420940
2020-08-21 12:50:56 +01:00
..
2020-07-09 08:28:14 +00:00
2020-07-09 08:28:14 +00:00

ExoPlayer Media2 extension

The Media2 extension provides builders for SessionPlayer and MediaSession.SessionCallback in the Media2 library.

Compared to MediaSessionConnector that uses MediaSessionCompat, this provides finer grained control for incoming calls, so you can selectively allow/reject commands per controller.

Getting the extension

The easiest way to use the extension is to add it as a gradle dependency:

implementation 'com.google.android.exoplayer:extension-media2:2.X.X'

where 2.X.X is the version, which must match the version of the ExoPlayer library being used.

Alternatively, you can clone the ExoPlayer repository and depend on the module locally. Instructions for doing this can be found in ExoPlayer's top level README.

Using the extension

Using SessionPlayerConnector

SessionPlayerConnector is a SessionPlayer implementation wrapping a given Player. You can use a SessionPlayer instance to build a MediaSession, or to set the player associated with a VideoView or MediaControlView

Using SessionCallbackBuilder

SessionCallbackBuilder lets you build a MediaSession.SessionCallback instance given its collaborators. You can use a MediaSession.SessionCallback to build a MediaSession.

  • Javadoc: Classes matching com.google.android.exoplayer2.ext.media2.* belong to this module.