-
Notifications
You must be signed in to change notification settings - Fork 137
SquareBar Visualizer
Gautam Chibde edited this page Aug 16, 2019
·
1 revision
add SquareBarVisualizer to you XML layout.
<com.chibde.visualizer.SquareBarVisualizer
android:id="@+id/visualizer"
android:layout_width="match_parent"
android:layout_height="250dp"/>
In your java class
SquareBarVisualizer squareBarVisualizer = findViewById(R.id.visualizer);
// set custom color to the line.
squareBarVisualizer.setColor(ContextCompat.getColor(this, R.color.custom));
// define custom number of bars you want in the visualizer between (10 - 256).
squareBarVisualizer.setDensity(65);
// Set Spacing
squareBarVisualizer.setGap(2);
// Set your media player to the visualizer.
squareBarVisualizer.setPlayer(mediaPlayer.getAudioSessionId());
- Credits @imranhsn
Use of the visualizer requires the permission android.permission.RECORD_AUDIO so make sure to add it to your manifest file.