Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 views
in Technique[技术] by (71.8m points)

audio - Get the AudioSessionID of the speakers in android

I'm trying to visualize whichever song or sound is playing on the phone's speakers currently, at first I used 0 as sessionID, because I read that, this would be the correct way to get the sessionID of the speakers, this was deprecated at the time and now, 0 doesn't work anymore, this is the error I got when executing with sessionID = 0.

E/AudioEffect: set(): AudioFlinger could not create effect e46b26a0-dddd-11db-8afd-0002a5d5c51b / ???Jw, status: -1
E/visualizers-JNI: Visualizer initCheck failed -3
E/Visualizer-JAVA: Error code -3 when initializing Visualizer. 

this is my code for initializing the visualizer, I currently use this library to visualize my audio

                    //get reference to visualizer
                    mVisualizer = findViewById(R.id.blast);
                    //set audioSessionID to zero
                    mVisualizer.setAudioSessionId(0);

Now my question is: since 0 was removed as the sessionID for speakers? Did it get replaced or is there now another way to get the sessionID of the speakers? Hope somebody on here can help me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...