We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
thnaks for great library in case it is of use to anyone this is simle implementation using just java
public MediaPlayer mediaPlayer; BarVisualizer barVisualizer; RelativeLayout rel; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_main); rel=new RelativeLayout(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) { // put your code for Version>=Marshmallow } else { if (shouldShowRequestPermissionRationale(Manifest.permission.RECORD_AUDIO)) { Toast.makeText(this, "App required access to audio", Toast.LENGTH_SHORT).show(); } requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO }, 100); } } else { // will do later } mediaPlayer = MediaPlayer.create(this, R.raw.sample); mediaPlayer.start(); int id= mediaPlayer.getAudioSessionId(); if (id !=-1){ System.out.println("aaaaaaaaaaaaaa "+id); barVisualizer=new BarVisualizer(this); barVisualizer.setPlayer(id);//(mediaPlayer.getAudioSessionId()); barVisualizer.setVisibility(View.VISIBLE); barVisualizer.setColor(Color.RED); barVisualizer.setDensity(80); rel.addView(barVisualizer); System.out.println("bbbbbbbbbbbbbb "+id); }else{ System.out.println("mediaplay id is null"); } setContentView(rel); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == 101) { if (grantResults[0] != PackageManager.PERMISSION_GRANTED) { Toast.makeText(getApplicationContext(), " record", Toast.LENGTH_SHORT).show(); } } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
thnaks for great library in case it is of use to anyone this is simle implementation using just java
The text was updated successfully, but these errors were encountered: