Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
526 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...