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

valueNotifier.value doesn't change #10

Open
ajsatam opened this issue Jul 20, 2019 · 6 comments
Open

valueNotifier.value doesn't change #10

ajsatam opened this issue Jul 20, 2019 · 6 comments

Comments

@ajsatam
Copy link

ajsatam commented Jul 20, 2019

Hi @siddhesh-tamhanekar
I have created an event listener like below to capture index change when playing a playlist. But whenever the event listener fires it only throws an initial value it never gives an updated value. Below is my function.

void initAudio() async {

    player = MediaPlayerPlugin.create(isBackground: true, showNotification: true);
    await player.initialize();

    player.valueNotifier.addListener(() {

      this.currentPlaylistIndex = player.valueNotifier.value.currentIndex;
      print("state changed:"+player.valueNotifier.value.duration.toString());

      print("state changed:"+player.valueNotifier.value.currentIndex.toString());


      setState(()
      {

      });
    });


    await player.setPlaylist(Playlist(playlist));
    player.play();

    setState(() {
       audioState = 1;
    });
  }
}
@siddhesh-tamhanekar
Copy link
Owner

Hi @ajsatam I have used the media player at multiple applications I didn't come across such error

You can look at the sample application https://github.com/siddhesh-tamhanekar/podcastApp
which demonstrates building duration widgets and playlist etc.

Your code looks okay at first glance but needs to debug about what is going wrong can you share more details such as your device, android version and useful debugging information.

meanwhile, you can try to install the podcast app given above and try if it works fine on the device.

Hopefully, This will help you to solve your problem
All the best.

@ajsatam
Copy link
Author

ajsatam commented Jul 21, 2019

Hi @siddhesh-tamhanekar I checked the project. Downloaded the apk on One Plus six and One plus 7 pro and it's the same. While the podcast changes but the name of the podcast and selected podcast in the list view below remains the same. It doesn't change.

Below is the device information:
Name: One Plus six, One plus 7 Pro
Android version : 9
OxygenOS version : 9.0.7

Please let me know if you need any more information.

@siddhesh-tamhanekar
Copy link
Owner

HI @ajsatam I have checked for android version:9 (pie) on the emulator and it works perfectly maybe there is a problem with OxygenOS

Unfortunately, I didn't have Oneplus device so couldn't able to debug.

will you please provide debug log message which could reveal the information

@ajsatam
Copy link
Author

ajsatam commented Jul 21, 2019

Also checked on the below device but the same issue

Name : Lenovo K50
Android version : 5.0

@siddhesh-tamhanekar
Copy link
Owner

@ajsatam I don't have either 5.0 version device.
You could share logs here to get some clue.

@ajsatam
Copy link
Author

ajsatam commented Jul 21, 2019

I'm a bit new to Android studio but it's the same which you get in the Console window right? Here it is. Please let me know otherwise.

Lenovo log.zip

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

No branches or pull requests

2 participants