Code Monkey home page Code Monkey logo

jcplayer's Introduction


JcPlayer

A simple audio player for Android that you can plugin to your apps quickly get audio playback working.

New features

  • Raw files
  • Asset Files
  • Local files

Tested files

Not tested URLs

Gradle Dependency (Project level)

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Gradle Dependency (Module level)

dependencies {
    // ... other dependencies
    compile 'com.github.jeancsanchez:JcPlayer:{version}'
}

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"/>

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.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
 }

How to contribute

Follow this guidelines, specially the commits style guide:
https://github.com/jeancsanchez/Android-Guidelines-and-Architecture/blob/master/code_guidelines.md

Note

The list view is developer responsibilty

TODO LIST

  • Set custom layouts for player.
  • Add Instrumentation tests
  • Add unity tests.

jcplayer's People

Contributors

jeancsanchez avatar joielechong avatar peace-shillong avatar irajul avatar

Watchers

Faker~ avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.