当前位置: 代码迷 >> 综合 >> OpenSLES -- AudioFlinger could not create effect
  详细解决方案

OpenSLES -- AudioFlinger could not create effect

热度:32   发布时间:2024-02-04 22:07:11.0

错误提示
E/AudioEffect: set(): AudioFlinger could not create effect, status: -1

添加权限

<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.INTERNET"/>

发现仍然报错,于是去Activity请求权限。

	void GetAudioPermission() {if (!CheckAudioPermission()) {ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.RECORD_AUDIO}, 2);}}boolean CheckAudioPermission() {boolean bGranted = true;//判断当前是否已授权if(ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED){bGranted = false;}return bGranted;}void GetInterNetPermission() {if (!CheckInterNetPermission()) {ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.INTERNET, Manifest.permission.MODIFY_AUDIO_SETTINGS}, 2);}}boolean CheckInterNetPermission() {boolean bGranted = true;if(ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED){bGranted = false;}if(ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.MODIFY_AUDIO_SETTINGS) != PackageManager.PERMISSION_GRANTED){bGranted = false;}return bGranted;}
  相关解决方案