A simple audio player for Android that you can plugin to your apps quickly get audio playback working.
- Raw files
- Asset Files
- Local files
- http://xxxx/abc.m4a
- http://xxxx:1232
- http://xxxx/abc.pls
- http://xxxx/abc.ram
- http://xxxx/abc.wax
- rtmp://xxxx
- http://xxxx/abc.aspx
- http://xxxx/abc.php
- http://xxxx/abc.html
- mms://xxxx
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
// ... other dependencies
compile '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.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);
jcplayerView.initAnonPlaylist(jcAudios);
jcplayerView.initWithTitlePlaylist(urls, "Awesome music");
jcplayerView.createNotification(); // default icon
OR
jcplayerView.createNotification(R.drawable.myIcon); // Your icon resource
MyActivity implements JcPlayerService.JcPlayerServiceListener {
....
jcplayerView.registerServiceListener(this);
// Just be happy :D
}
Follow this guidelines, specially the commits style guide:
https://github.com/jeancsanchez/Android-Guidelines-and-Architecture/blob/master/code_guidelines.md
- The JcpService is only started when some audio is played.
- The list view is developer responsibilty
- Set custom layouts for player.
- Add Instrumentation tests
- Add unity tests.