4 Commits

Author SHA1 Message Date
ibaker
873ec1544e Remove nested import of Player.Events from PlayerExtensions.listen
This makes it clearer that the part inside and outside the parentheses
are clearly different, and not "just" a reference to `Player.Events`.
Specifically this syntax is showing that the function has a `Player`
"receiver", **and** is a function from `Player.Events` to `Unit`.

https://kotlinlang.org/docs/lambdas.html#function-types

PiperOrigin-RevId: 663293405
2024-08-15 07:07:48 -07:00
ibaker
ef6cb5d913 Use runCatching instead of try/catch in PlayerExtensionsTest
PiperOrigin-RevId: 661992546
2024-08-12 01:44:53 -07:00
jbibik
9ace81bf2f Move PlayerExtensions into common-ktx module
For now, the only extension function on the `Player` has been used in a Compose demo. It can be promoted to a proper module where in the future other extension functions will reside. Given that `Player` is in `androidx.media3.common`, the corresponding KTX library for it is `androidx.media3.common-ktx`

To start using the new `suspend fun listen`, one must add `androidx.media3:media3-common-ktx` as a Gradle dependency and `import androidx.media3.common.listen`

PiperOrigin-RevId: 658771029
2024-08-02 06:24:10 -07:00
jbibik
018d0488e1 Create a new media3-common-ktx module
It will be used for Kotlin-specific functionality like extension functions on the classes from the `media3-common` module. To import it, add the following to your build.gradle file:

`implementation("androidx.media3:media3-common-ktx:1.X.Y")`

PiperOrigin-RevId: 658492256
2024-08-01 12:14:16 -07:00