Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove duration and progress indicator in Android Auto when playing live stream #1758

Open
jqi26 opened this issue Sep 26, 2024 · 8 comments

Comments

@jqi26
Copy link

jqi26 commented Sep 26, 2024

I'm working on an app that plays a live-stream for a radio station that also needs Android Auto support. I'm trying to find a way to hide the progress indicator and duration (which seems to default to 1:40) on the Android Auto UI, given it doesn't make sense for a live stream. Looking at #339 I assumed maybe there was a player/session command to control this, but I've tried a few with no luck so far. Does a command (or any other way to control this programmatically) exist?

@tonihei
Copy link
Collaborator

tonihei commented Oct 10, 2024

We fixed #1256 in Media3 1.4.0, that sounds like the exact same issue. Which version are you using at the moment?

@albinus-sc
Copy link

@jqi26 I managed to remove the progress bar by setting the METADATA_KEY_DURATION extra to -1 on MediaMetadata.extras.

But I have the same issue, @tonihei, in that I don't know what to set to remove the duration in Android Auto, which is just showing the duration of the live buffer which is not very useful nor user friendly.

@tonihei
Copy link
Collaborator

tonihei commented Oct 11, 2024

@albinus-sc : Same question as above - is this still happening with 1.4.0 or are you on an earlier version? I believe we fixed this, so it would be good to know in which circumstances it still shows up the live buffer duration. If you have a reproducible example on the latest version, please share more details so we can take a look. You can also send test media links to android-media-github@google.com and report back here if you don't want to share it publicly.

@albinus-sc
Copy link

@tonihei Yes, we're using 1.4.1.

I'm not sure how to give a reproducible example. But I can say that our live buffer is about half an hour, and that half hour is what gets pasted into the duration on Android Auto. It works as intended in the media notification on Android 14. No duration is shown there, and no progress bar either.

image

@albinus-sc
Copy link

@tonihei I have sent the HLS stream link we use to the provided email address.

@jqi26
Copy link
Author

jqi26 commented Oct 17, 2024

Thanks @tonihei . No we're still on 1.3.1, can confirm I get the same result as @albinus-sc after upgrading.

1.3.1:
Screenshot 2024-10-17 at 12 54 48 PM

1.4.1:
Screenshot 2024-10-17 at 12 47 52 PM

Ideally it would be possible to get rid of the progress bar and time elapsed entirely? Though I see the bar is in the notification as well. Also tried seeing what happens in the Media3 sample when I stick our m3u8 file there; I get this:

Screenshot 2024-10-17 at 12 38 36 PM

Similarly the time elapsed keeps resetting to zero seconds, ideally these elements aren't there at all.

@billyjoker
Copy link

Hi the same issue for me, I added in this way but it has no effect

                val extras = Bundle().apply {
                    putLong(MediaMetadataCompat.METADATA_KEY_DURATION, C.TIME_UNSET)
                }
                val playbackStateBuilder = PlaybackStateCompat.Builder().apply {
                    setState(PlaybackStateCompat.STATE_PLAYING, C.TIME_UNSET, 1f, C.TIME_UNSET)
                    setActions(PlaybackStateCompat.ACTION_PAUSE)
                    setExtras(extras)
                }
                mMediaSession?.setPlaybackState(playbackStateBuilder.build())
            The same behaviour using a `-1` instead of `C.TIME_UNSET`. I am using legacy instead of Media3.
            
            POSSIBLE HINT: maybe it could be resolved by hiding the field using reflection ? @tonihei 

@albinus-sc
Copy link

@tonihei Hey, any update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants