Earlier, using boundService this could be easily achieved. But with MediaBrowserService I can't access getDuration outside, without which I am unable to update the seekbar.
How do I call getDuration in mediaBrowserService from an Activity?
1.1k Views Asked by V1 Kr At
1
There are 1 best solutions below
Related Questions in ANDROID-SERVICE
- My Foreground service is crashing on Android 14
- How to launch android activity in background, or minimized, when screen locked in Android 14 and start the activity with broadcast intent
- The slider does not move after pausing the player MediaSession Android studio
- Android service and thread in singleton are the equivalent?
- How to ensure that my foreground service will be running as long as possible?
- onServiceConnected not called but context#bindService return true
- How can I make an app reopen when closed on an Android device?
- stopservice does not work after ondestroy
- How to run a service in background on Android 10? Rooted device
- How to disable TileService for Android 34+ but keep for previous versions?
- Is okay to collect state from Service in ViewModel for my android app?
- What is the differernce between foreground and background service in Android in terms of code?
- Users crashing because of Service.startForeground() not allowed due to mAllowStartForeground false only on Anddroid 14
- .NET MAUI Android - Unable to create service: class not found exception
- Delphi Android service was stopped after closing the android application
Related Questions in ANDROID-MEDIAPLAYER
- onCompletion(mp: MediaPlayer?) is unintentionally called after USB storage is connected
- Android Media3: App launched from tapping media notification but extras from PendingIntent are not set
- Android media library, how to start media download only when needed?
- Using MediaPlayer slows down SoundPool sound effect
- Media3 notification: How to update title dynamically during playback
- Android Media3: How to split HLS stream into multiple mediaitems each with own range
- How to listen to media session events of another app
- Unity VideoPlayer cannot play iPhones videos on Android
- How to run Android MediaPlayer
- In Android Media3 MediaSessionService how to specify HLS streaming source
- Android Jetpack Compose Media3 HLS Stream with playback service
- Callback invocation in Android when Google Assistant starts listening
- Android Media3 (ExoPlayer): How to set defaultPositionUs of a Window in the Timeline?
- Changing the video scale (Android Java)
- Playing Audio files in chunks and downloading
Related Questions in ANDROID-SEEKBAR
- How to use seek bar thumb override view on Android kotlin
- It is possible to position a slider on a discrete seekBar on continious values in Android
- How to keep the seek bar persistent even after back button is pressed and re opened player activity
- How can I find out the SeekBar's onStartTrackingTouch provided by default in PlayerNotificationManager?
- Seek method of just_audio is not working in Flutter
- How to indicate the all the step values below seekbar in android
- Android how to make a SeekBar thicker?
- Android : How to change the seekbar tick mark color after the progress
- Thumb is on top of the seekbar
- Custom View Seekbar in android
- How can we design a SeekBar with custom Thumb UI and a Text inside it and custom SeekBar Track UI?
- Kotlin how to data transfer with navigation
- I want to create a seekbar in android(xml and kotlin).How?
- Syncing Progress of mediaplayer with ObjectAnimator
- SeekBar doesn't react to user's touches
Related Questions in ANDROID-MEDIASESSION
- Android Media3: App launched from tapping media notification but extras from PendingIntent are not set
- androidx media router and media session
- Media3 notification: How to update title dynamically during playback
- The slider does not move after pausing the player MediaSession Android studio
- Android Media3: How to split HLS stream into multiple mediaitems each with own range
- How to listen to media session events of another app
- In Android Media3 MediaSessionService how to specify HLS streaming source
- Android Jetpack Compose Media3 HLS Stream with playback service
- How to disable duration using media3
- How to clear the Resumable audio notification
- Media Session Notification Not Show in LockScreen in Samsung Android 13
- How to get the player variable from MediaSessionService example in docs?
- Media3 ExoPlayer notification artwork overlaps previous ones
- In Android MediaSessionCompat.Callback onSeekTo() how to detect event is from the notification player
- Media 3 Player Not Play Video With Media Session
Related Questions in MEDIABROWSERSERVICE
- How to programmatically navigate in Android MediaBrowserService OnLoadChildren method
- Change Style of Single Item in MediaBrowserService on Android Automotive
- how to show indicator for current playing queueitem in mediabrowserservice (android auto) android?
- Android Auto media app issue with duplicate apps
- MediaDescription.Builder() not setting MediaItem Icon
- How to resolve leak at androidx.media.MediaBrowserServiceCompat?
- How to get MediaMetadataCompat from an specific single File
- Cannot get app to respond to Bluetooth controls
- Android Auto: How to return a large number of children on loadChildren() of MediaBrowserService?
- MediaBrowserServiceCompat: Context.startForegroundService() did not then call Service.startForeground()
- Refresh Media in Android Auto MediaBrowserService
- Android Automotive OS not displaying playable MediaItem's
- Android assistant - MediaBrowserService - Voice command - "Play x on appName"
- MediaBrowserService with ExoPlayer and PlayerControlView - How to access to the player instance from the UI (PlayerControlView)?
- Is it possible to connect to Spotify's MediaBrowserService?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
On the MediaBrowserService, when you're updating the MediaMetadata, add the duration of the current media.
While on the client side, using MediaBrowserCompat you're able to connect to you MediaBrowserService and retrieve a MediaSessionCompat.Token. With the token you can then get a MediaSessionController from where you can get the MediaMetadataCompat that has information about the current media.
The official documentation has an ok explanation on how this works a whole