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

Plays on an OpenHome device and lets the device own the playlist: the queue of the device is the playlist this player shows and edits (insert, delete), the transport buttons go to the device, and what the device reports (track, state, position, volume, repeat, shuffle) is what the screen shows. More...

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

Classes

interface  Job
 

Public Member Functions

 OpenHomePlayer (UpnpClient upnpClient, Device<?, ?, ?> receiverDevice, String name, String shortName)
 
void attach ()
 Takes up a device that plays already (started by another controller, or by this app before it was reinstalled): the player reads the playlist and the state of the device and shows them.
 
boolean isUnreachable ()
 True once the device did not answer several times in a row; the screen can say so.
 
void play ()
 start playing the current item
 
void pause ()
 Pause the current item.
 
void stop ()
 stops playing.
 
void next ()
 play the next item
 
void playItemAt (int index)
 Plays the item at the index (a playing, paused or stopped player starts it).
 
void previous ()
 play the previous item
 
void seekTo (long millisecondsFromStart)
 
void fastForward (int seconds)
 fast forward seconds
 
void fastRewind (int seconds)
 fast rewind seconds
 
void setItems (PlayableItem... playableItems)
 Set a List of Items.
 
void addItems (List< PlayableItem > playableItems)
 adds additional item to the end of the playlist
 
void clear ()
 Drops all Items.
 
boolean removeItem (int itemIndex)
 Removes an item from the playlist (and from the play order).
 
boolean removeItem (int itemIndex, boolean alsoPlayed)
 Removes an item.
 
boolean isPlaylistPositionLocked (int position)
 The device decides what it plays next: nothing of the playlist is locked, except the picked files it was given already (a file the device has not got yet can still be taken out of the list).
 
boolean moveInPlayOrder (int fromPosition, int toPosition)
 Moves a track of the playlist (what a drag in the list does).
 
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 setPlayMode (PlayMode mode)
 Changes the repeat and shuffle mode of this player; the current item goes on playing.
 
long getCurrentPosition ()
 returns the current position of the current item in millis
 
String getDuration ()
 returns the duration of the current item
 
String getElapsedTime ()
 returns the elapsed time of the current item
 
int getVolume ()
 
void setVolume (int volume)
 
boolean getMute ()
 
void setMute (boolean mute)
 
boolean hasActionGetVolume ()
 
boolean hasActionGetMute ()
 
String getDeviceId ()
 
int getIconResourceId ()
 
PendingIntent getNotificationIntent ()
 Opens the player screen (the one of the AVTransport player: it shows and controls any player with its playlist, volume, repeat and shuffle).
 
URI getAlbumArt ()
 The album art of the current track: the albumArtURI of its metadata.
 
Bitmap getIcon ()
 The notification shows the album art when it is in the cache; it is fetched for the next update when it is not.
 
String getDeviceName ()
 The name of the device this player plays on, for the player screen.
 
void onDestroy ()
 The playlist belongs to the device: closing the player ends the screen and the poll, the device keeps playing.
 
- Public Member Functions inherited from de.yaacc.player.AbstractPlayer
 AbstractPlayer (UpnpClient upnpClient)
 
MediaSessionCompat getMediaSession ()
 Get the MediaSession for this player.
 
void onServiceConnected (ComponentName className, IBinder binder)
 
void onServiceDisconnected (ComponentName className)
 
Context getContext ()
 
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.
 
int[] getPlayOrder ()
 
int getNextItemIndex ()
 
int getPreviousItemIndex ()
 
boolean isPlaying ()
 
boolean isPaused ()
 
boolean isStopped ()
 
void setPlaying (boolean isPlaying)
 
List< PlayableItem > getItems ()
 
String getPositionString ()
 returns the current item position in the playlist
 
int getCurrentItemIndex ()
 
String getCurrentItemTitle ()
 returns the title of the current item
 
String getNextItemTitle ()
 returns the title of the next 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.
 
- Public Member Functions inherited from de.yaacc.player.Player

Protected Member Functions

OhControl createControl ()
 The way to the device; tests replace it.
 
int getNotificationId ()
 Returns the notification id of the player.
 
void stopItem (PlayableItem playableItem)
 
Object loadItem (PlayableItem playableItem)
 
void startItem (PlayableItem playableItem, Object loadedItem, int index)
 
- 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 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 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.
 
void onItemsInserted (int index, List< PlayableItem > inserted)
 Items were put into the list at index.
 
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)
 
void doPostLoadItem (PlayableItem playableItem)
 
void doPause ()
 
void doResume ()
 
long getSilenceDuration ()
 returns the duration between two items
 
void updateTimer ()
 
long parseTimeStringToMillis (String timeString)
 
void showNotificationInternal ()
 
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.AbstractPlayer
- Static Package Attributes inherited from de.yaacc.player.AbstractPlayer

Detailed Description

Plays on an OpenHome device and lets the device own the playlist: the queue of the device is the playlist this player shows and edits (insert, delete), the transport buttons go to the device, and what the device reports (track, state, position, volume, repeat, shuffle) is what the screen shows.

The player holds no queue of its own.

All calls to the device run one after the other on one worker thread; the callers only hand their work over. The device is asked for its state about every two seconds and after every command.

Member Function Documentation

◆ addItems()

void de.yaacc.player.OpenHomePlayer.addItems ( List< PlayableItem > items)

adds additional item to the end of the playlist

Parameters
itemsthe items to be added

Reimplemented from de.yaacc.player.AbstractPlayer.

Referenced by de.yaacc.player.OpenHomePlayer.insertItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ attach()

void de.yaacc.player.OpenHomePlayer.attach ( )

Takes up a device that plays already (started by another controller, or by this app before it was reinstalled): the player reads the playlist and the state of the device and shows them.

Nothing is sent to the device: it is not woken up, its source is not changed (that happens with the first command of the user).

Referenced by de.yaacc.player.PlayerService.attachOpenHomePlayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void de.yaacc.player.OpenHomePlayer.clear ( )

Drops all Items.

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ fastForward()

void de.yaacc.player.OpenHomePlayer.fastForward ( int i)

fast forward seconds

Parameters
iseconds

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ fastRewind()

void de.yaacc.player.OpenHomePlayer.fastRewind ( int i)

fast rewind seconds

Parameters
iseconds

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ getAlbumArt()

URI de.yaacc.player.OpenHomePlayer.getAlbumArt ( )

The album art of the current track: the albumArtURI of its metadata.

The address comes from the device, so only http and https addresses are used.

Reimplemented from de.yaacc.player.AbstractPlayer.

Referenced by de.yaacc.player.OpenHomePlayer.getIcon().

Here is the caller graph for this function:

◆ getCurrentPosition()

long de.yaacc.player.OpenHomePlayer.getCurrentPosition ( )

returns the current position of the current item in millis

Returns
the position

Reimplemented from de.yaacc.player.AbstractPlayer.

Referenced by de.yaacc.player.OpenHomePlayer.fastForward(), de.yaacc.player.OpenHomePlayer.fastRewind(), and de.yaacc.player.OpenHomePlayer.getElapsedTime().

Here is the caller graph for this function:

◆ getDeviceId()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getDuration()

String de.yaacc.player.OpenHomePlayer.getDuration ( )

returns the duration of the current item

Returns
the duration

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getElapsedTime()

String de.yaacc.player.OpenHomePlayer.getElapsedTime ( )

returns the elapsed time of the current item

Returns
the elapsed time

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ getIcon()

Bitmap de.yaacc.player.OpenHomePlayer.getIcon ( )

The notification shows the album art when it is in the cache; it is fetched for the next update when it is not.

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ getIconResourceId()

int de.yaacc.player.OpenHomePlayer.getIconResourceId ( )

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getMute()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getNotificationId()

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

Returns the notification id of the player.

Returns
the notification id

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ getNotificationIntent()

PendingIntent de.yaacc.player.OpenHomePlayer.getNotificationIntent ( )

Opens the player screen (the one of the AVTransport player: it shows and controls any player with its playlist, volume, repeat and shuffle).

Used by the notification, the receiver rows and the mini player.

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ getVolume()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ hasActionGetMute()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ hasActionGetVolume()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ insertItems()

void de.yaacc.player.OpenHomePlayer.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.

Parameters
indexwhere the first new item goes; clamped to the list
playableItemsthe new items

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ isPlaylistPositionLocked()

boolean de.yaacc.player.OpenHomePlayer.isPlaylistPositionLocked ( int position)

The device decides what it plays next: nothing of the playlist is locked, except the picked files it was given already (a file the device has not got yet can still be taken out of the list).

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ loadItem()

Object de.yaacc.player.OpenHomePlayer.loadItem ( PlayableItem playableItem)
protected

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ moveInPlayOrder()

boolean de.yaacc.player.OpenHomePlayer.moveInPlayOrder ( int fromPosition,
int toPosition )

Moves a track of the playlist (what a drag in the list does).

The list shows the new order at once, the device is told on the worker. The track that plays, and in a picked queue the files the device has, stay where they are.

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ next()

void de.yaacc.player.OpenHomePlayer.next ( )

play the next item

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ onDestroy()

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

The playlist belongs to the device: closing the player ends the screen and the poll, the device keeps playing.

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ pause()

void de.yaacc.player.OpenHomePlayer.pause ( )

Pause the current item.

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ play()

void de.yaacc.player.OpenHomePlayer.play ( )

start playing the current item

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ playItemAt()

void de.yaacc.player.OpenHomePlayer.playItemAt ( int index)

Plays the item at the index (a playing, paused or stopped player starts it).

Nothing happens for an index outside the list.

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ previous()

void de.yaacc.player.OpenHomePlayer.previous ( )

play the previous item

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ removeItem() [1/2]

boolean de.yaacc.player.OpenHomePlayer.removeItem ( int itemIndex)

Removes an item from the playlist (and from the play order).

Parameters
itemIndexthe index into getItems()
Returns
false if nothing was removed: the index is invalid or the item is locked

Reimplemented from de.yaacc.player.AbstractPlayer.

Referenced by de.yaacc.player.OpenHomePlayer.removeItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeItem() [2/2]

boolean de.yaacc.player.OpenHomePlayer.removeItem ( int itemIndex,
boolean alsoPlayed )

Removes an item.

The playlist screen only removes what still lies ahead; the OpenHome queue may drop what has been played as well (alsoPlayed), but never the item that plays now.

Returns
false (and nothing changed) if the item is not in the list or is locked

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ seekTo()

void de.yaacc.player.OpenHomePlayer.seekTo ( long millisecondsFromStart)

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ setItems()

void de.yaacc.player.OpenHomePlayer.setItems ( PlayableItem... items)

Set a List of Items.

Parameters
itemsthe items to be played

Reimplemented from de.yaacc.player.AbstractPlayer.

Here is the call graph for this function:

◆ setMute()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ setPlayMode()

void de.yaacc.player.OpenHomePlayer.setPlayMode ( PlayMode mode)

Changes the repeat and shuffle mode of this player; the current item goes on playing.

Fires PROPERTY_PLAY_MODE if the mode differs.

Parameters
modethe new mode, null is ignored

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ setVolume()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ startItem()

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

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ stop()

void de.yaacc.player.OpenHomePlayer.stop ( )

stops playing.

And returns to the beginning of the item list.

Reimplemented from de.yaacc.player.AbstractPlayer.

◆ stopItem()

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

Reimplemented from de.yaacc.player.AbstractPlayer.


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