media icon indicating copy to clipboard operation
media copied to clipboard

Hide disabled seekbar and position display in Android Auto for live streams

Open NielsMasdorp opened this issue 1 year ago • 7 comments

I apologise if this project is not the right place to ask this, but I figured i'd give it a shot.

My app plays streams of internet radio stations and my MediaItems are very concise:

MediaItem.Builder()
        .setMediaId(id)
        .setUri(url.toUri())
        .setMediaMetadata(
            MediaMetadata.Builder()
                .setMediaType(MediaMetadata.MEDIA_TYPE_RADIO_STATION)
                .setArtist(title)
                .setArtworkUri(imageUrl.toUri())
                .setIsPlayable(true)
                .setIsBrowsable(false)
                .build()
        )
        .build()

They all play fine and the media session notifications only show the title of the radio station, the dynamic track as updated through the stream and play, pause, previous and next actions.

But when I expose my content to Android Auto on the head unit there is also a duration timer and an empty seekbar visible:

image

Both are not needed since it is a live stream, but I cant seem to figure out how to remove those elements from the UI. I tried disabling all seek commands from the session via MediaLibrarySession.setAvailableCommands() but to no avail.

Care to point me in the right direction? Thanks in advance.

NielsMasdorp avatar May 03 '23 20:05 NielsMasdorp