Coder Social home page Coder Social logo

ambience's Introduction

Ambience

The Simplest Audio Player Service Library for Android

Introduction

Ambience is a small and powerful android library that helps you build advanced audio apps in minutes. Built upon many of android's system components and powerful open source libraries, Ambience is fast, efficient and easy to use.

Ambience is compatible with android mobile, tv and auto. Pass Ambience a playlist filled with tracks then lean back and relax. Ambience will continue to play audio even when the app is placed in the background.

Ambience.turnOn(context)
        .setPlaylistTo(playlist)
        .play();

Features

Playback Controls

Customize and play any playlist with just one line of code. Play, Skip, Forward, Rewind, Pause and Volume Control are just a few of the playback controls that Ambience provides.

Ambience.activeInstance()
        .shuffleAndSetPlaylistTo(playlist)
        .setVolumeTo(0.5f)
        .playFromPosition(3);
Custom Notifications

Ambience creates a custom notification for each track in the playlist. Users can use these notifications to control playback options and jump right back into your app. Notifications created by Ambience will also show up on wearable devices that are connected to the app. For android tv and auto apps, a notification will show as a now playing card in the recommendation section.

To launch an activity from a notification, pass a unique Intent-Filter action name.

Ambience.activeInstance().setNotificationLaunchActivity(actionName);
Callback Methods

Get notified when an event occurs or playback options change via the AmbientListener interface. The AmbientListener provides several callback methods that are triggered for the current playing track or when an event occurs in the service.

Ambience.activeInstance().listenForUpdatesWith(AmbientListener);
AmbientTrack

Store track meta data with the AmbientTrack class. The AmbientTrack class extends on the android's Parcelable class. This allows an AmbientTrack to be easily integrated or shared between projects.

public void bindView(View view, Parcelable object) {
    AmbientTrack track = (AmbientTrack) object;
   ((TextView) view).setText(track.getName());
}

How it Works

Ambience - A BroadcastReceiver that sends and receivers request from the AmbientService. This class provides methods for controlling audio playback. Ambience will trigger update methods on a callback object that has implemented the AmbientListener interface.

AmbientService - An Android Service that allows audio playback in the background. The AmbientService listens for a request, performs the request on the current playlist and alerts the Ambience class when done.

AmbientTrack - A class that holds meta data for a single track.

AmbientListener - A callback interface that is triggered when an event has occurred in the AmbientService.


Version

Current Version == v1.5

Visit the Ambience Website for more information.


Sample Code

Get the sample code here.


Contribute

Before submitting a request, please make sure that your code runs on an android device.


License

Copyright 2014 TonyoStudios.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Disclaimer

The Ambience Library uses Picasso a powerful image downloading and caching library for android. Picasso is property of Square Inc and is provided under the Apache 2.0 License. Visit square.github.io/Picasso for more information.

ambience's People

Watchers

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