Skip to content

dylanmaryk/RadioPlayerService

 
 

Repository files navigation

RadioPlayerService

Android Arsenal

Android service library which uses AAC Player. Ready to use Radio Player Service. (Android Background Player Service)

Features

  • Play and stop live radio streams on background.
  • Handle incoming and outgoing calls.

Usage

Gradle

repositories {
    maven {
        url "https://jitpack.io"
    }
}
dependencies {
    compile 'com.github.iammert:RadioPlayerService:4ab6bafbbf'
}

Using Radio Player Service

In your Activity

RadioManager mRadioManager = RadioManager.with(this);
//Invoke it #onCreate
mRadioManager.registerListener(this);
//Invoke it #onStart
mRadioManager.connect();
//Invoke it #onDestroy
mRadioManager.disconnect();

Play and pause radio like

//starts radio streaming.
mRadioManager.startRadio(RADIO_URL);
//stop radio streaming.
mRadioManager.stopRadio();

Implement RadioListener to get notified on radio state changed.

public class MainActivity extends Activity implements RadioListener
...
 @Override
    public void onRadioConnected() {
        
    }

    @Override
    public void onRadioStarted() {
        
    }

    @Override
    public void onRadioStopped() {
        
    }

    @Override
    public void onMetaDataReceived(String s, String s1) {
        
    }
...

Any fragments can be informed when it is registered.

public class Fragment1 extends Fragment implements RadioListener
...
//invoke this #onCreateView
RadioManager.with(getActivity()).registerListener(this);

//invoke this #onStop()
RadioManager.with(getActivity()).unregisterListener(this);

Demo project will help you to understand implementation.

TODO LIST##

  • Create Notification on Background Service.
  • Decode and Buffer size setter methods

Libraries Used

AAC Decoder Library

License

Copyright 2015 Mert Şimşek.

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.

About

Android service library which uses AAC Player. Ready to use Radio Player Service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%