Adaptr Player
Adaptr Media client that retrieves music from the Adaptr servers and plays them on the local device. The player can be assigned either an on demand AudioFile from search or playlists/Stations or an active station from list of online stationList or offline localOfflineStationList stations using play.
To make sure the music begins when requested user should call prepareToPlay before calling play
The player exposes its current State to assist with rendering playback state.
Player methods are almost all asynchronous, and the player makes heavy use of Listener classes to allow clients to monitor events and changes in the player state.
In most use cases, the player isn't useful until it has successfully contacted the Adaptr servers to retrieve a list of available streaming stations, and the AvailabilityListener helps with determining when music becomes available or playback.
Constructors
Create an instance of the player.
Create a new instance of the player, and register an AvailabilityListener to receive notice when the Adaptr servers have been contacted and streaming music is found to be available or not.
Create a new instance of the player with an AvailabilityListener, and optionally ensure all player methods run in a background thread.
Types
Functions
Register an AvailabilityListener to be notified when music is determined to be available or not.
Register a LikeStatusChangeListener to be notified when the like status of song change.
Register a MusicQueuedListener to receive notice when music is queued in the current station for immediate playback.
Add OutOfMusicListener
Register a new PlayListener to receive notice when songs start, elapse, or have their skippability change.
Register a SkipListener to receive notice when a skip succeeds or fails.
Add StateListener to the player
Register a StationChangedListener to receive notice of change in the player's current active station.
Register an UnhandledErrorListener to receive notice of errors that the player doesn't know how deal with.
Ask the Adaptr servers for a new client id for this device, then set that to the current and default client id via setClientId, then inform the provided listener what the new client id is.
Create a playlist from a collection of audio files. Call Save on editor to save the playlist to the server.
Delete any and all locally stored audio files.
Delete all locally stored audio files from the given station.
Delete a previously saved playlist.
Safely Destroys this instance of FeedAudioPlayer and frees up any resources it is using. If you have a reference to this object it should be set to null and a new instance should be created via initialize the next time music is to be played.
Downloads or updates an offline station.
Download or update an offline station, but with an extra hint to the server as to the number of minutes of music that the client wants to be downloaded. This can be used to prevent a station with, say, 600 minutes, from being completely downloaded in a single call. If the given station already has content stored on the device, the server determines whether or not the client will 1) download any music,
Get Favorite tacks for the user
Get the playlist to view the play queue
Retrieve All previously saved playlists by the user. If the listener returns null no playlists were found
Returns max no of seconds that a station can skip, usually between 300 to 700 seconds
Start music playback. Will begin playback if there is any music in the queue. This should only be called to resume music playback. The music should be set using overloads of play. Even if prepareToPlay() has been called earlier, the music may or may not start immediately when this function is called. To be sure that playback will start when this function is called, user should wait for onPlayItemReadyForPlayback callback in MusicQueuedListener before calling this function.
Begin playback of a specific onDemand song.
Play the given station, with optional crossfade between the current song and the song in the new station.
Tell the player that the given list of stations are expected to be imminently streamed, so that it can try to perform network operations ahead of time.
Register a MusicQueuedListener to be notified when the given is queued up for immediate playback upon calling play.
Register a MusicQueuedListener to be notified when a song is queued up for immediate playback upon calling play.
Remove previously registered LikeStatusChangeListener
Remove a previously registered MusicQueuedListener from the player.
Remove previously registered OutOfMusicListener
Remove a previously registered PlayListener from the player
Remove previously registered SkipListener
Remove previously registered StateListener from the player
Remove StationChangedListener from the player
Remove previously registered UnhandledErrorListener
Get tracks for an empty playlist previously save to server. if the listener returns null there were no tracks to be fetched.
Request files for a Station
Search the current placement for music related to a search term, results will be delivered to the listener. If the results will be playable using (play)
Seek the current station by this no of seconds.
Change station to the given one, with optional crossfade between the current song and the song in the new station.
Update the player's client id to a value previously returned from clientId, effectively changing the identity of current music listener.
Set a new mixing audio player.
Trigger this method to send the logs of the current session to Adaptr servers
Switch back to default Mixingplayer.
Unfavourite a previously favorited audiofile
Properties
Request skip on the currently playing song, and provide a SkipListener to receive notice if the skip succeeded or failed.
Return the current unique client id so that it can be externally persisted or synchronized across devices and later passed to setClientId or Builder.setClientId.
The current NotificationStyle in use by Adaptr.
This PendingIntent is attached to any Notification created by Adaptr.