|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.content.Context
android.content.ContextWrapper
android.app.Service
sk.baka.ambient.playerservice.PlayerService
public final class PlayerService
Simply plays required audio files. Invokes IPlayerListener handler
when the playback is finished.
This service mainly prevents Android to kill the application when no activities are shown on screen.
| Field Summary | |
|---|---|
(package private) PlayerStateEnum |
playerState
The playback state. |
| Constructor Summary | |
|---|---|
PlayerService()
|
|
| Method Summary | |
|---|---|
(package private) IPlayerListener |
getInvocator()
Returns a proxy which posts events using the SimpleBus
object. |
(package private) void |
invokeError(String message,
Throwable ex,
boolean missing)
An error occurred. |
void |
metadataReceived(String title,
Map<String,String> metadata)
Invoked when the radio transmits additional metadata. |
IBinder |
onBind(Intent intent)
|
void |
onBufferingUpdate(MediaPlayer mp,
int percent)
|
void |
onCompletion(MediaPlayer arg0)
|
void |
onCreate()
|
void |
onDestroy()
|
boolean |
onError(MediaPlayer player,
int what,
int extra)
|
void |
onPrepared(MediaPlayer p)
|
void |
opened(String name,
String genre,
boolean hasMetaint,
Map<String,String> metadata)
The stream was opened and the SHOUTcast metadata was read. |
| Methods inherited from class android.app.Service |
|---|
dump, finalize, getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onUnbind, setForeground, stopSelf, stopSelf, stopSelfResult |
| Methods inherited from class android.content.Context |
|---|
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
volatile PlayerStateEnum playerState
| Constructor Detail |
|---|
public PlayerService()
| Method Detail |
|---|
public void onCreate()
onCreate in class Servicepublic void onDestroy()
onDestroy in class Servicepublic IBinder onBind(Intent intent)
onBind in class ServiceIPlayerListener getInvocator()
SimpleBus
object.
public void onCompletion(MediaPlayer arg0)
onCompletion in interface MediaPlayer.OnCompletionListener
void invokeError(String message,
Throwable ex,
boolean missing)
message - the error message.ex - the error cause, may be null if not knownmissing - if true then this error was caused by a file
missing.
public boolean onError(MediaPlayer player,
int what,
int extra)
onError in interface MediaPlayer.OnErrorListenerpublic void onPrepared(MediaPlayer p)
onPrepared in interface MediaPlayer.OnPreparedListener
public void metadataReceived(String title,
Map<String,String> metadata)
IShoutcastListener
metadataReceived in interface IShoutcastListenertitle - the 'StreamTitle' metadatametadata - all metadata
public void opened(String name,
String genre,
boolean hasMetaint,
Map<String,String> metadata)
IShoutcastListener
opened in interface IShoutcastListenername - the name of the radio stationgenre - the genrehasMetaint - if true then the radio stream will periodically
transmit metadata (and the
IShoutcastListener.metadataReceived(String, Map) will be invoked).metadata - all present metadata.
public void onBufferingUpdate(MediaPlayer mp,
int percent)
onBufferingUpdate in interface MediaPlayer.OnBufferingUpdateListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||