YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.player.SendspinPlayer Class Reference

The player that plays the queue of the app to a Sendspin player (issue #325), in the shape of SnapcastPlayer: ExoPlayer plays as always but its audio does not go to the phone's speaker; a processor chain (FeedTapChain) converts what ExoPlayer decodes to PCM 16 bit stereo at the rate the player listed and hands it to the PcmStreamer of the connection, which cuts it into timestamped chunks, paces them and sends them. More...

Inheritance diagram for de.yaacc.player.SendspinPlayer:
Inheritance graph
Collaboration diagram for de.yaacc.player.SendspinPlayer:
Collaboration graph

Public Member Functions

 SendspinPlayer (UpnpClient upnpClient, SendspinReceiverDevice device, int sampleRate, String name, String shortName)
 
void onDestroy ()
 Kill the player.
 
String getDeviceId ()
 
int getVolume ()
 
void setVolume (int volume)
 
boolean getMute ()
 
void setMute (boolean mute)
 
boolean hasActionGetVolume ()
 
boolean hasActionGetMute ()
 
- Public Member Functions inherited from de.yaacc.player.LocalMediaSessionPlayer
 LocalMediaSessionPlayer (UpnpClient upnpClient, String name, String shortName)
 
 LocalMediaSessionPlayer (UpnpClient upnpClient)
 
void play ()
 start playing the current item
 
void pause ()
 Pause the current item.
 
void stop ()
 stops playing.
 
MediaSession getMedia3Session ()
 Get the Media3 MediaSession (not the legacy MediaSessionCompat).
 
void onServiceConnected (ComponentName className, IBinder binder)
 
int getIconResourceId ()
 
void setItems (PlayableItem... playableItems)
 Set a List of Items.
 
void addItems (List< PlayableItem > incoming)
 Items added while ExoPlayer has the playlist (add to playlist during playback) are appended to it at once; before, they only reached ExoPlayer with the next start of an item, so it never played them.
 
String getNextItemTitle ()
 returns the title of the next current item
 
void next ()
 play the next item
 
void previous ()
 play the previous item
 
long getCurrentPosition ()
 returns the current position of the current item in millis
 
void seekTo (long millisecondsFromStart)
 
String getDuration ()
 returns the duration of the current item
 
String getElapsedTime ()
 returns the elapsed time of the current item
 
URI getAlbumArt ()
 
PendingIntent getNotificationIntent ()
 Returns the intent which is to be started by pushing the notification entry.
 
MediaSessionCompat getMediaSession ()
 Get the MediaSession for this player.
 
- Public Member Functions inherited from de.yaacc.player.AbstractPlayer
 AbstractPlayer (UpnpClient upnpClient)
 
void onServiceDisconnected (ComponentName className)
 
Context getContext ()
 
Bitmap getIcon ()
 
void setIcon (Bitmap icon)
 
UpnpClient getUpnpClient ()
 
void startService ()
 
void onItemEnded ()
 The current item has ended by itself (a timer, or the renderer reported it): go on as the play mode says, which unlike next() repeats the item with repeat one.
 
PlayMode getPlayMode ()
 The repeat and shuffle mode of this player.
 
void setPlayMode (PlayMode mode)
 Changes the repeat and shuffle mode of this player; the current item goes on playing.
 
int[] getPlayOrder ()
 
boolean isPlaylistPositionLocked (int position)
 
boolean moveInPlayOrder (int fromPosition, int toPosition)
 Moves an item in the playlist as the screen shows it: with shuffle the item moves in the play order (the list is not touched), otherwise in the list.
 
boolean removeItem (int itemIndex)
 Removes an item from the playlist (and from the play order).
 
boolean removeItem (int itemIndex, boolean alsoPlayed)
 Removes an item.
 
int getNextItemIndex ()
 
int getPreviousItemIndex ()
 
void clear ()
 Drops all Items.
 
boolean isPlaying ()
 
boolean isPaused ()
 
boolean isStopped ()
 
void setPlaying (boolean isPlaying)
 
List< PlayableItem > getItems ()
 
void insertItems (int index, List< PlayableItem > playableItems)
 Puts items into the middle of the playlist (the OpenHome renderer's queue): the item that plays keeps playing, the play order places the new items (behind the current one with shuffle), an engine that holds the list too is told.
 
void playItemAt (int index)
 Plays the item at the index (a playing, paused or stopped player starts it).
 
String getPositionString ()
 returns the current item position in the playlist
 
int getCurrentItemIndex ()
 
String getCurrentItemTitle ()
 returns the title of the current item
 
void setShareLease (QueueShareWindow.Lease lease)
 Makes this player hold the shares of a picked queue just in time: from now on loading an item binds the share of that item and of the next one and releases what the player left behind.
 
long getRemainingTime ()
 
void startTimer (final long duration)
 Start a timer for the next item change.
 
String getName ()
 Get the player name.
 
void setName (String name)
 Set the name of the player.
 
boolean isProcessingCommand ()
 
void setProcessingCommand (boolean isProcessingCommand)
 
void exit ()
 Exit the player.
 
int getId ()
 Returns the id of the Player.
 
void addPropertyChangeListener (PropertyChangeListener listener)
 add a property change listener
 
void removePropertyChangeListener (PropertyChangeListener listener)
 remove a property change listener
 
String getShortName ()
 Get the player short name.
 
void setShortName (String name)
 Set the short name of the player.
 
void fastForward (int i)
 fast forward seconds
 
void fastRewind (int i)
 fast rewind seconds
 
- Public Member Functions inherited from de.yaacc.player.Player

Protected Member Functions

ExoPlayer createExoPlayer ()
 Builds the ExoPlayer of this player.
 
void startItem (final PlayableItem playableItem, final Object loadedItem, final int index)
 
void doResume ()
 
void stopItem (PlayableItem playableItem)
 
int getNotificationId ()
 Returns the notification id of the player.
 
- Protected Member Functions inherited from de.yaacc.player.LocalMediaSessionPlayer
Object loadItem (PlayableItem playableItem)
 
void doPostLoadItem (PlayableItem playableItem)
 
void onItemsInserted (int index, List< PlayableItem > inserted)
 Items put into the middle of the list reach ExoPlayer at their place; the item that plays keeps playing.
 
void onPlayModeChanged (PlayMode oldMode, PlayMode newMode)
 The engine of a player applies the new play mode here (the order of the items is already adapted: see getPlayOrder()).
 
void onItemMoved (int fromIndex, int toIndex)
 The list order changed: the item at fromIndex moved to toIndex (shuffle is off).
 
void onItemRemoved (int index)
 The item at index was removed from the list and the play order.
 
void onPlayOrderMoved ()
 The play order changed by a move (shuffle is on, the list is unchanged); read it with getPlayOrder().
 
void doPause ()
 
void showNotificationInternal ()
 
- Protected Member Functions inherited from de.yaacc.player.AbstractPlayer
void configureMediaSession (MediaSessionCompat mediaSession)
 Override this to configure MediaSession (e.g., set volume provider for remote playback).
 
boolean isShufflePlay ()
 is shuffle play enabled.
 
PlayMode readDefaultPlayMode ()
 The mode a new player starts with: the two settings "replay playlist" and "shuffle music".
 
void resetPlayOrder (int firstIndex)
 Creates the play order of the playlist again with the given item first (with shuffle a new random order, otherwise the list order).
 
void cancelTimer ()
 
void setPaused (boolean paused)
 
final void adoptExternalPause ()
 Another controller than this app paused the playback (the media notification, the lock screen, a headset or the loss of the audio focus): the engine is paused already, only what the app knows about its player and shows is brought up to date.
 
final void adoptExternalResume ()
 The playback that was paused goes on without a command of this app (see adoptExternalPause()).
 
void setCurrentIndex (int currentIndex)
 
final synchronized void adoptDeviceState (List< PlayableItem > deviceItems, int index, boolean nowPlaying, boolean nowPaused)
 For a player whose playlist and playback live on a device (OpenHome): takes over what the device reports.
 
QueueShareWindow.Lease getShareLease ()
 The lease of the shares of a picked queue, null for every other player.
 
Object loadItem (int toLoadIndex)
 
void loadItem (int previousIndex, int nextIndex)
 
long getSilenceDuration ()
 returns the duration between two items
 
void updateTimer ()
 
long parseTimeStringToMillis (String timeString)
 
void updatePlaybackStateInternal (int state)
 
void updateMetadataInternal ()
 
void firePropertyChange (String property, Object oldValue, Object newValue)
 
void executeCommand (TimerTask command, Date executionTime)
 

Additional Inherited Members

- Public Attributes inherited from de.yaacc.player.Player
String PROPERTY_PLAY_MODE = "playMode"
 Name of the property change fired (see addPropertyChangeListener) when the play mode changed; old and new value are PlayModes.
 
String PROPERTY_PLAYLIST = "playlist"
 Name of the property change fired when the playlist changed: items set, added, removed or moved, or the play order created again (a stop, a start).
 
String PROPERTY_STOPPED = "stopped"
 Name of the property change fired when the player has stopped: stop() is done, whoever called it - the end of the playlist without repeat, the stop button of the app, the media renderer's Stop.
 
- Static Public Attributes inherited from de.yaacc.player.AbstractPlayer
static final String PLAYER_ID = "PlayerId"
 
static final String PROPERTY_ITEM = "item"
 
static final String PROPERTY_PAUSED = "paused"
 Fired when the player is paused or resumed (the "playing" property is fired when it starts or stops playing).
 
- Package Functions inherited from de.yaacc.player.LocalMediaSessionPlayer
- Package Functions inherited from de.yaacc.player.AbstractPlayer
- Static Package Attributes inherited from de.yaacc.player.AbstractPlayer

Detailed Description

The player that plays the queue of the app to a Sendspin player (issue #325), in the shape of SnapcastPlayer: ExoPlayer plays as always but its audio does not go to the phone's speaker; a processor chain (FeedTapChain) converts what ExoPlayer decodes to PCM 16 bit stereo at the rate the player listed and hands it to the PcmStreamer of the connection, which cuts it into timestamped chunks, paces them and sends them.

The streamer's wait is what keeps ExoPlayer at real time.

  • A start waits for the connection to be ready. Playing to a player that is not approved is the operator's approval (spec: "an operator action that clearly means to use the client"); a player that demands pairing, lost its pairing or can not be given a stream says so in a message.
  • A pause of ExoPlayer, from wherever it comes, ends the stream (stream/end); the resume starts it again. A seek flushes the tap, which sends stream/clear. A stop ends the stream.
  • The volume and mute are the player's own (a command to the player); the phone's volume is never touched.

The rate of the tap is chosen when the player is made (ExoPlayer is built later, when the service connects), so the app makes the player only when the rate of the Sendspin player is known; see PlayerService.

Constructor & Destructor Documentation

◆ SendspinPlayer()

de.yaacc.player.SendspinPlayer.SendspinPlayer ( UpnpClient upnpClient,
SendspinReceiverDevice device,
int sampleRate,
String name,
String shortName )
Parameters
devicethe player this plays to
sampleRatethe rate of its stream (from its hello); the tap converts to it
Here is the call graph for this function:

Member Function Documentation

◆ createExoPlayer()

ExoPlayer de.yaacc.player.SendspinPlayer.createExoPlayer ( )
protected

Builds the ExoPlayer of this player.

A plain one here; a subclass that needs its own renderers (the Snapcast player taps the decoded audio) overrides this and returns a player built for it. Called once, on the thread that initializes the player, with the context of the player available; the result is used as ExoPlayer was before.

Reimplemented from de.yaacc.player.LocalMediaSessionPlayer.

Here is the call graph for this function:

◆ doResume()

void de.yaacc.player.SendspinPlayer.doResume ( )
protected

◆ getDeviceId()

String de.yaacc.player.SendspinPlayer.getDeviceId ( )

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getMute()

boolean de.yaacc.player.SendspinPlayer.getMute ( )

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getNotificationId()

int de.yaacc.player.SendspinPlayer.getNotificationId ( )
protected

Returns the notification id of the player.

Returns
the notification id

Reimplemented from de.yaacc.player.LocalMediaSessionPlayer.

◆ getVolume()

int de.yaacc.player.SendspinPlayer.getVolume ( )

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ hasActionGetMute()

boolean de.yaacc.player.SendspinPlayer.hasActionGetMute ( )

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ hasActionGetVolume()

boolean de.yaacc.player.SendspinPlayer.hasActionGetVolume ( )

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ onDestroy()

void de.yaacc.player.SendspinPlayer.onDestroy ( )

Kill the player.

Reimplemented from de.yaacc.player.LocalMediaSessionPlayer.

Here is the call graph for this function:

◆ setMute()

void de.yaacc.player.SendspinPlayer.setMute ( boolean mute)

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ setVolume()

void de.yaacc.player.SendspinPlayer.setVolume ( int volume)

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ startItem()

void de.yaacc.player.SendspinPlayer.startItem ( final PlayableItem playableItem,
final Object loadedItem,
final int index )
protected

◆ stopItem()

void de.yaacc.player.SendspinPlayer.stopItem ( PlayableItem playableItem)
protected

The documentation for this class was generated from the following file: