• Stars
    star
    238
  • Rank 169,306 (Top 4 %)
  • Language
    Java
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple themable & integrable audio player library for Android.

Index

Audio Wife - Introduction

A simple themable & integrable audio player library for Android. Helps you have an Audio Controller for your Audio Player UI. Have your own UI and pass the instance of UI controls like Play button, Pause button, Seekbar etc to AudioWife and rest is taken care of.

your_player.xml

Audio Player Playing

Audio Player Paused

Demo

Demo Gif

Caution!

Eclipse library project structure has been dropped. If you wish to use this library in your eclipse IDE, please checkout eclipse-develop. No further development will be done or merged into eclipse-develop branch.

Why this project?

  1. A simple native audio player API wrapper
  2. Others found were complex & provided no way to be integrate as library
  3. Some even involved compilation using Android NDK

Features

  1. Provides default UI truly making it an integrable player.
  2. Ability to set multiple custom click handlers to play and pause buttons.
  3. No dependencies.

Including in your project

AudioWife is presented as an Android library project.

You can include this project by referencing it as a library project in Eclipse or ant.

This project has NO DEPENDENCIES.

Download

Gradle:

{
	compile 'net.the4thdimension:audio-wife:1.0.3'
}

Requires Android 4.0+.

Getting started

Permission required to play audio

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

##Using default player UI

AudioWife comes with a simple default player UI that you can use right away. This is the simplest and fastest way to get AudioWife working.

// mPlayerContainer = Parent view to add default player UI to.
AudioWife.getInstance().init(mContext, uri)
		.useDefaultUi(mPlayerContainer, getLayoutInflater());

##Using custom player UI

You can initialize the custom player controls of your UI using AudioWife

// initialize the player controls
mPlayMedia = findViewById(R.id.play);
mPauseMedia = findViewById(R.id.pause);
mMediaSeekBar = (SeekBar) findViewById(R.id.media_seekbar);
mRunTime = (TextView) findViewById(R.id.run_time);
mTotalTime = (TextView) findViewById(R.id.total_time);

// AudioWife takes care of click handler for play/pause button
AudioWife.getInstance()
		 .init(mContext, uri)
		 .setPlayView(mPlayMedia)
		 .setPauseView(mPauseMedia)
		 .setSeekBar(mMediaSeekBar)
		 .setRuntimeView(mRunTime)
		 .setTotalTimeView(mTotalTime);

// to explicitly pause
AudioWife.getInstance().pause();


// when done playing, release the resources
AudioWife.getInstance().release();

##Add custom listeners

To extend the capabilities of AudioWife, custom click listeners can be attached. Refer to source documentation for more details.

AudioWife.getInstance().addOnCompletionListener( new MediaPlayer.OnCompletionListener() {
	
	@Override
	public void onCompletion(MediaPlayer mp) {
		Toast.makeText(getBaseContext(), "Completed", Toast.LENGTH_SHORT)
			 .show();
		// do you stuff
	}
});

AudioWife.getInstance().addOnPlayClickListener(new View.OnClickListener() {
	
	@Override
	public void onClick(View v) {
		Toast.makeText(getBaseContext(), "Play", Toast.LENGTH_SHORT)
			 .show();
		// Lights-Camera-Action. Lets dance.
	}
});

AudioWife.getInstance().addOnPauseClickListener(new View.OnClickListener() {
	
	@Override
	public void onClick(View v) {
		Toast.makeText(getBaseContext(), "Pause", Toast.LENGTH_SHORT)
			 .show();
		// Your on audio pause stuff.
	}
});

Why the name 'AudioWife'?

This relates with another Android AudioRecorder library project that is coming soon. The name AudioWife comes from an analogy of a married couple where the wife is an active Player, hence AudioWife for Audio Player and husband being a Listener hence AudioHusband for Audio Recorder.

Later found that Audio Recorder Library project already exists for Android. You can find it here.

Contributing

Please fork this repository and contribute back using pull requests.

Please follow Android coding style guide

Developed by

Credits

Official Android MediaPlayer Dev Docs

Android MediaPlayer Tutorial

License

The MIT License (MIT)

Copyright (c) 2014 Jaydeep

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

poly-picker

Android library project for providing multiple image selection from the device.
Java
406
star
2

android-utils

Library for utility classes that can make me and others more productive.
Java
216
star
3

simplest-sync-adapter

The bare minimum code that one will have to write to build a working sync adapter for an android app.
Java
10
star
4

jquerymobile-dynamic-listview

Creating a listview dynamically using javascript.
7
star
5

questionnaire

Android library to create & navigate within different types of questions which can be used in an android application. It can be used for "Take-Test" kind of feature, if any, in your application.
Java
6
star
6

google-docs-as-database

Using google docs as a read-only database for HTML5 based applications.
5
star
7

jaydeepw.github.com

My site
JavaScript
3
star
8

adb-restarter

Restart ADB as root from command line
Python
3
star
9

avantika-university

Sample code and demo implemented during session at Avantika Universtiy.
Java
3
star
10

coordinate-drawings

Kotlin
2
star
11

cardslib-eclipse

Eclipse port of cardslib for Android
Java
2
star
12

tech-talks

Presentations and demos of the tech talks that I delivered at various places.
JavaScript
1
star
13

photoview-eclipse

Eclipse port of PhotoView image zooming library for Android
Java
1
star
14

google-maps-selector

Java
1
star
15

flutterbook

A facebook skeleton application using Flutter.
Dart
1
star
16

socket-io-demo

A minimalist and simple project to learn and try out socket.io
JavaScript
1
star
17

ffmpeg-android

Working demo of FFMpeg on Android using JNI.
C
1
star
18

content-provider

Java
1
star
19

experiments

Some experiments that I am usually engaged in. This will NOT be useful to anybody.
Java
1
star
20

android-mvvm-gjk

A simple application using MVVM arch. pattern for Android
1
star
21

backend-snetworks

A simple web service using NodeJS that exposes a GET API
JavaScript
1
star
22

express-learning

A repo created when I started learning ExpressJS.
JavaScript
1
star
23

android-mvvm-slk

A demo search application in Kotlin and MVVM architecture
Kotlin
1
star
24

boiler-plates

contains boiler plate code for HTML, Media Queries, Simple Android App, JQueryMobile and many to be added with time.
1
star
25

timesheet-maker

Python script/app that reformats office check in and check out times in WhatsApp to excel sheet friendly format
Python
1
star
26

flutter-experiements

Dart
1
star
27

android-crop

Java
1
star
28

google-analytics-notifier

Receive audio, visual notifications from Google Analytics whenever user count goes beyond certain threshold on your site/blog.
JavaScript
1
star
29

sync-adapters

learning sync adapters in android
1
star
30

android-test

Java
1
star
31

video-frames

Java
1
star
32

bb10-opensource

My Open Source code for BB10 that I think can be reused by somebody sometime. :)
C++
1
star
33

offlinr

JavaScript
1
star
34

android-multiple-image-picker-eclipse

Eclipse port of https://github.com/giljulio/android-multiple-image-picker
Java
1
star
35

1942-tanks

A simple HTML5 game build by me in 2011 to learn programming in JavaScript. It uses HTML5 Canvas. Its not very advanced. Just putting out here so anyone can clone and extend it.
JavaScript
1
star
36

temploid

A template app for Android. An Android template application to quickly get started with a new Android application project.
Java
1
star