Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Android Seek bar starting position is not not working on notification area #350

Open
3 of 4 tasks
ajoykarmakar opened this issue Oct 10, 2020 · 1 comment
Open
3 of 4 tasks

Comments

@ajoykarmakar
Copy link

Issue

I am using this plugin since 1 year and it's working very beautifully. Now when a android 10 user play a mp3 with this notification plugin a seekbar is available in the notification area to seek the position of the mp3 and it's working too but the marked area in the attached image's seekbar current position is never changing it's always show 0 that's means the seekbar is not syncing with the mp3 position.

I have attached a other application working demo Image to explain the problem -

image

The total code snippet -

musicControlsSetup() {
   // const track = this.props.tracks[this.state.selectedTrack];
   MusicControl.setNowPlaying({
     title: TRACKS[0].title,
     artwork: require('../assets/imgs/album.jpg'), // URL or RN's image require()
     artist: TRACKS[0].artist,
     duration: this.state.totalLength, // (Seconds)
     description: '', // Android Only
     color: 0x000000, // Notification Color - Android Only
     date: '1983-01-02T00:00:00Z', // Release Date (RFC 3339) - Android Only
     rating: 84, // Android Only (Boolean or Number depending on the type)
     notificationIcon: 'media_play_icon', // Android Only (String), Android Drawable resource name for a custom notification icon
   });

   // Seeking
   MusicControl.enableControl('seek', true); // Android only

   // Basic Controls
   MusicControl.enableControl('play', true);
   MusicControl.enableControl('pause', true);
   MusicControl.enableControl('skipBackward', true, {interval: 15});
   MusicControl.enableControl('skipForward', true, {interval: 15});
   MusicControl.enableControl('closeNotification', true, {when: 'paused'});
   MusicControl.enableBackgroundMode(true);

   MusicControl.on('play', () => {
     this.setState({paused: false});
     MusicControl.updatePlayback({
       state: MusicControl.STATE_PLAYING, // (STATE_ERROR, STATE_STOPPED, STATE_PLAYING, STATE_PAUSED, STATE_BUFFERING)
     });
   });

   MusicControl.on('pause', () => {
     this.setState({paused: true});
     MusicControl.updatePlayback({
       state: MusicControl.STATE_PAUSED, // (STATE_ERROR, STATE_STOPPED, STATE_PLAYING, STATE_PAUSED, STATE_BUFFERING)
     });
   });

   MusicControl.on('skipForward', () => {
     this.seek(this.state.currentPosition + 15);
   });

   MusicControl.on('skipBackward', () => {
     this.seek(this.state.currentPosition - 15);
   });

   MusicControl.on('seek', (pos) => {
     this.seek(pos);
   });
 }
  1. Platform

    • iOS
    • Android
  1. Device
  • Simulator
  • Real device
@krunalbad
Copy link
Contributor

try to update elapsedTime also in component progress
https://github.com/tanguyantoine/react-native-music-control#update-playback

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

No branches or pull requests

2 participants