• Home
Name Date Size #Lines LOC

..--

src/03-May-2024-5,8704,501

README.mdD03-May-20242.3 KiB5335

build.gradleD03-May-20241.9 KiB4238

README.md

1# Media2 module
2
3The Media2 module provides builders for [SessionPlayer][] and
4[MediaSession.SessionCallback][] in the [Media2 library][].
5
6Compared to [MediaSessionConnector][] that uses [MediaSessionCompat][], this provides finer grained
7control for incoming calls, so you can selectively allow/reject commands per controller.
8
9## Getting the module
10
11The easiest way to get the module is to add it as a gradle dependency:
12
13```gradle
14implementation 'com.google.android.exoplayer:extension-media2:2.X.X'
15```
16
17where `2.X.X` is the version, which must match the version of the other media
18modules being used.
19
20Alternatively, you can clone this GitHub project and depend on the module
21locally. Instructions for doing this can be found in the [top level README][].
22
23[top level README]: https://github.com/google/ExoPlayer/blob/release-v2/README.md
24
25## Using the module
26
27### Using `SessionPlayerConnector`
28
29`SessionPlayerConnector` is a [SessionPlayer][] implementation wrapping a given `Player`.
30You can use a [SessionPlayer][] instance to build a [MediaSession][], or to set the player
31associated with a [VideoView][] or [MediaControlView][]
32
33### Using `SessionCallbackBuilder`
34
35`SessionCallbackBuilder` lets you build a [MediaSession.SessionCallback][] instance given its
36collaborators. You can use a [MediaSession.SessionCallback][] to build a [MediaSession][].
37
38## Links
39
40* [Javadoc][]: Classes matching
41  `com.google.android.exoplayer2.ext.media2.*` belong to this module.
42
43[Javadoc]: https://exoplayer.dev/doc/reference/index.html
44
45[SessionPlayer]: https://developer.android.com/reference/androidx/media2/common/SessionPlayer
46[MediaSession]: https://developer.android.com/reference/androidx/media2/session/MediaSession
47[MediaSession.SessionCallback]: https://developer.android.com/reference/androidx/media2/session/MediaSession.SessionCallback
48[Media2 library]: https://developer.android.com/jetpack/androidx/releases/media2
49[MediaSessionCompat]: https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat
50[MediaSessionConnector]: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.html
51[VideoView]: https://developer.android.com/reference/androidx/media2/widget/VideoView
52[MediaControlView]: https://developer.android.com/reference/androidx/media2/widget/MediaControlView
53