Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.rohankandwal:jcplayer:2.6.26'
}
dependencies {
implementation("com.github.rohankandwal:jcplayer:2.6.26")
}
<dependency>
<groupId>com.github.rohankandwal</groupId>
<artifactId>jcplayer</artifactId>
<version>2.6.26</version>
</dependency>
libraryDependencies += "com.github.rohankandwal" % "jcplayer" % "2.6.26"
:dependencies [[com.github.rohankandwal/jcplayer "2.6.26"]]
A simple audio player for Android that you can plugin to your apps quickly get audio playback working. </br></br>

allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
// ... other dependencies
implementation 'com.github.jeancsanchez:JcPlayer:{version}'
}
You only need a JcPlayerView on your Layout Activity/Fragment. All the controls and everything else are created by the player view itself.
<com.example.jean.jcplayer.view.JcPlayerView
android:id="@+id/jcplayer"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
jcplayerView = (JcPlayerView) findViewById(R.id.jcplayerView);
ArrayList<JcAudio> jcAudios = new ArrayList<>();
jcAudios.add(JcAudio.createFromURL("url audio","http://xxx/audio.mp3"));
jcAudios.add(JcAudio.createFromAssets("Asset audio", "audio.mp3"));
jcAudios.add(JcAudio.createFromRaw("Raw audio", R.raw.audio));
jcplayerView.initPlaylist(jcAudios, null);
jcplayerView.initAnonPlaylist(jcAudios);
jcplayerView.initWithTitlePlaylist(urls, "Awesome music");
jcplayerView.createNotification(); // default icon
OR
jcplayerView.createNotification(R.drawable.myIcon); // Your icon resource
MyActivity implements JcPlayerManagerListener {
....
jcplayerView.setJcPlayerManagerListener(this);
// Just be happy :D
}
You can customize the player layout by manipulating these attributes.
app:next_icon
app:next_icon_color
app:pause_icon
app:pause_icon_color
app:play_icon
app:play_icon_color
app:previous_icon
app:previous_icon_color
app:progress_color
app:random_icon_color
app:repeat_icon
app:repeat_icon_color
app:seek_bar_color
app:text_audio_current_duration_color
app:text_audio_duration_color
app:text_audio_title_color
The layout of the playlist is responsability of the developer.