Closed salvonos closed 7 years ago
According to the logs, your MediaPlayer
instance equals null
. Check your AudioVisualizationFragment
on line 60. This crash doesn't related to library.
P.S. Do not use static variables for holding a MediaPlayer
instance.
Thank you for your quick replay. I understand that the value is null but If I don't use static variables how could I send the audio from mediaPlayer to the fragment?
@salvonos. MediaPlayer
is not required for visualizer handler. You can pass audio session ID instead. There are several ways to communicate with service:
MediaPlayer
or audioSessionId
;audioSessionId
;Thanks I will try this. I have also tried to use "0" as session ID which should corresponds to the audio output mix? However, not animation is received
I have tried almost everything but cannot work it out. I have tried to start the media player direct into the fragment but the visualiser is not animating:
mediaPlayer = MediaPlayer.create(getContext(), R.raw.sound);
mediaPlayer.start();
audioVisualization.linkTo(DbmHandler.Factory.newVisualizerHandler(context, mediaPlayer));
Have you checked Troubleshooting section in Readme? It's possible that visualizer will not work on some devices. What device are you using?
I am using Samsung Galaxy S5. I can see the visualiser but not animating
I am trying to connect the visualiser with a music player from MainActivity.java. The visualiser is set in a fragment and all works well when I call it showing it in the activity however, overtime I try to add the MusicPlayer i get the error:
I have called the music player from MusicService.java
AudioVisualizationFragment.java
MainActivity.java
How could I solve this error?