Giter Site home page Giter Site logo

Comments (4)

zeroed-tech avatar zeroed-tech commented on May 29, 2024 1

Got it working!

It apears you can't style songs directly under your library root, i.e.

Root
  |-Song
  |-Song
  |-Song

They need to be under a container media item (i.e. an Album, artis, playlist, madeup container type)

Root
  |-Playlist
    |-Song
    |-Song

Thanks again for the help

from media.

marcbaechinger avatar marcbaechinger commented on May 29, 2024

Thanks for reporting!

This works for me with the session demo:

  @OptIn(UnstableApi::class)
  override fun onGetLibraryRoot(
    session: MediaLibraryService.MediaLibrarySession,
    browser: MediaSession.ControllerInfo,
    params: MediaLibraryService.LibraryParams?,
  ): ListenableFuture<LibraryResult<MediaItem>> {
    val rootExtras =
      Bundle().apply {
        putInt(
          MediaConstants.EXTRAS_KEY_CONTENT_STYLE_BROWSABLE,
          MediaConstants.EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_GRID_ITEM,
        )
        putInt(
          MediaConstants.EXTRAS_KEY_CONTENT_STYLE_PLAYABLE,
          MediaConstants.EXTRAS_VALUE_CONTENT_STYLE_CATEGORY_GRID_ITEM,
        )
      }
    return Futures.immediateFuture(
      LibraryResult.ofItem(
        MediaItemTree.getRootItem(),
        MediaLibraryService.LibraryParams.Builder().setExtras(rootExtras).build(),
      )
    )
  }

The only difference to your code I see is that the library params are created newly with MediaLibraryService.LibraryParams.Builder().setExtras(rootExtras).build(), but I don't think this should make a difference.

The same works with the media3 branch of UAMP that isn't using the same constants but the values that are used are the same.

from media.

zeroed-tech avatar zeroed-tech commented on May 29, 2024

Hey @marcbaechinger, thanks for the quick reply. I've confirmed that your example does what I'm after so now I have the fun task of working out whats different between my project and the example.

I'll drop another comment and close this off once I work out whats different.

from media.

marcbaechinger avatar marcbaechinger commented on May 29, 2024

Glad it's working and thanks for the update why it wasn't!

from media.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.