iRajul/JcPlayer


:musical_note: A simple audio player for Android applications.

Download


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.iRajul:JcPlayer:'
	}
	dependencies {
		implementation("com.github.iRajul:JcPlayer:")
	}
	<dependency>
	    <groupId>com.github.iRajul</groupId>
	    <artifactId>JcPlayer</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.iRajul" % "JcPlayer" % ""
        
        

                            
    :dependencies [[com.github.iRajul/JcPlayer ""]]
        
        

Readme


JcPlayer

Download </br> A simple audio player for Android that you can plugin to your apps quickly get audio playback working. </br></br> ![alt tag] (https://github.com/jeancsanchez/JcPlayer/blob/master/sample/jcplayer-gif-definitive.gif)

New features

  • Raw files
  • Asset Files
  • Local files

Tested files

  • http://xxxx/abc.mp3

Not tested URLs

  • 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

##Maven

allprojects {
    repositories {
        jcenter()
        maven {
            url  "http://dl.bintray.com/jeancsanchez/maven"
        }
    }
}

##Gradle Dependency

dependencies {
    // ... other dependencies
    compile 'io.github.jeancsanchez.jcplayer:jcplayer:2.6.0-alpha'
}

##Getting Started 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">
</com.example.jean.jcplayer.JcPlayerView>

##Code Setup ####Find your JcPlayerView xml and...

    jcplayerView = (JcPlayerView) findViewById(R.id.jcplayerView);

###Option 1: Just init a playlist

    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);

###Option 2: Initialize an anonymous playlist with a default title for all

    jcplayerView.addAudio(JcAudio.createFromURL("url audio","http://xxx/audio.mp3"));
    jcplayerView.addAudio(JcAudio.createFromAssets("audio.mp3"));
    jcplayerView.addAudio(JcAudio.createFromRaw(R.raw.audio));

    jcplayerView.initAnonPlaylist(jcAudios);

###Option 3: Initialize an playlist with a custom title for all

    jcplayerView.initWithTitlePlaylist(urls, "Awesome music");

###Call the notification player where you want.

    jcplayerView.createNotification(); // default icon

OR

    jcplayerView.createNotification(R.drawable.myIcon); // Your icon resource

###How can I get callbacks of player status?

    MyActivity implements JcPlayerService.JcPlayerServiceListener {
        ....
        jcplayerView.registerServiceListener(this);
        // Just be happy :D
 }

###Note

  • The list view is developer responsibilty

TODO LIST##

  • [ ] Support others audio formats.
  • [ ] Support and test others urls.