### Class

# RB ShellPlayer

#### Description [src]

    class RB.ShellPlayer : GObject.Object
    {
      RBShellPlayerPrivate* priv
    }

The shell player (or player shell, depending on who you’re talking to) manages the `RBPlayer` instance, tracks the current playing `RhythmDBEntry`, and manages the various `RBPlayOrder` instances. It provides simple operations such as next, previous, play/pause, and seek.

When playing internet radio streams, it first attempts to read the stream URL as a playlist. If this succeeds, the URLs from the playlist are stored in a list and tried in turn in case of errors. If the playlist parsing fails, the stream URL is played directly.

The mapping from the separate shuffle and repeat settings to an `RBPlayOrder` instance occurs in here. The play order logic can also support a number of additional play orders not accessible via the shuffle and repeat buttons.

If the player backend supports multiple streams, the shell player crossfades between streams by watching the elapsed time of the current stream and simulating an end-of-stream event when it gets within the crossfade duration of the actual end.

#### Ancestors

- GObject

#### Constructors

###### rb_shell_player_new

Creates the `RBShellPlayer`.

#### Instance methods

###### rb_shell_player_add_play_order

Adds a new play order to the set of available play orders.

###### rb_shell_player_do_next

Skips to the next song. Consults the play queue and handles transitions between the play queue and the active source. Fails if there is no entry to play after the current one.

###### rb_shell_player_do_previous

If the current song has been playing for more than 3 seconds, restarts it, otherwise, goes back to the previous song. Fails if there is no current song, or if inside the first 3 seconds of the first song in the play order.

###### rb_shell_player_get_active_source

Retrieves the active source. This is the source that the user selected for playback.

###### rb_shell_player_get_mute

Returns `TRUE` if currently muted.

###### rb_shell_player_get_playback_state

Retrieves the current state of the shuffle and repeat settings.

###### rb_shell_player_get_playing

Reports whether playback is occuring by setting #playing.

###### rb_shell_player_get_playing_entry

Retrieves the currently playing `RhythmDBEntry`, or NULL if nothing is playing. The caller must unref the entry (using #rhythmdb_entry_unref) when it is no longer needed.

###### rb_shell_player_get_playing_path

Retrieves the URI of the current playing entry. The caller must not free the returned string.

###### rb_shell_player_get_playing_song_duration

Retrieves the duration of the current playing song.

###### rb_shell_player_get_playing_source

Retrieves the current playing source. That is, the source from which the current song was drawn. This differs from

# rb_shell_player_get_active_source when the current song came

from the play queue.

###### rb_shell_player_get_playing_time

Retrieves the current playback position. Fails if the player currently cannot provide the playback position.

###### rb_shell_player_get_playing_time_string

Constructs a string showing the current playback position, taking the time display settings into account.

###### rb_shell_player_get_volume

Returns the current volume level.

###### rb_shell_player_jump_to_current

No description available.

###### rb_shell_player_pause

Pauses playback if possible, completely stopping if not.

###### rb_shell_player_play

Starts playback, if it is not already playing.

###### rb_shell_player_play_entry

Plays a specified entry.

###### rb_shell_player_playpause

Toggles between playing and paused state. If there is no playing entry, chooses an entry from (in order of preference) the play queue, the selection in the current source, or the play order.

###### rb_shell_player_remove_play_order

Removes a play order previously added with #rb_shell_player_add_play_order from the set of available play orders.

###### rb_shell_player_seek

Seeks forwards or backwards in the current playing song. Fails if the current song is not seekable.

###### rb_shell_player_set_mute

Updates the mute setting on the player.

###### rb_shell_player_set_playback_state

Sets the state of the shuffle and repeat settings.

###### rb_shell_player_set_playing_source

Replaces the current playing source.

###### rb_shell_player_set_playing_time

Attempts to set the playback position. Fails if the current song is not seekable.

###### rb_shell_player_set_selected_source

Updates the player to reflect a new source being selected.

###### rb_shell_player_set_volume

Sets the playback volume level.

###### rb_shell_player_set_volume_relative

Adds the specified value to the current volume level.

###### rb_shell_player_stop

Completely stops playback, freeing resources and unloading the file.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### RB.ShellPlayer:db

The `RhythmDB`.

###### RB.ShellPlayer:has-next

Whether there is a track to play after the current track.

###### RB.ShellPlayer:has-prev

Whether there was a previous track before the current track.

###### RB.ShellPlayer:header

The `RBHeader` object.

###### RB.ShellPlayer:mute

Whether playback is currently muted.

###### RB.ShellPlayer:play-order

The current play order object.

###### RB.ShellPlayer:player

The player backend object (an object implementing the `RBPlayer` interface).

###### RB.ShellPlayer:playing

Whether Rhythmbox is currently playing something.

###### RB.ShellPlayer:playing-from-queue

If `TRUE`, the current playing entry came from the play queue.

###### RB.ShellPlayer:queue-only

If `TRUE`, activating an entry should only add it to the play queue.

###### RB.ShellPlayer:queue-source

The play queue source.

###### RB.ShellPlayer:source

The current source that is selected for playback.

###### RB.ShellPlayer:volume

The current playback volume (between 0.0 and 1.0).

#### Signals

###### RB.ShellPlayer::elapsed-changed

Emitted when the playback position changes.

###### RB.ShellPlayer::elapsed-nano-changed

Emitted when the playback position changes. Only use this (as opposed to elapsed-changed) when you require subsecond precision. This signal will be emitted multiple times per second.

###### RB.ShellPlayer::playing-changed

Emitted when playback either stops or starts.

###### RB.ShellPlayer::playing-song-changed

Emitted when the playing database entry changes.

###### RB.ShellPlayer::playing-song-property-changed

Emitted when a property of the playing database entry changes.

###### RB.ShellPlayer::playing-source-changed

Emitted when a new `RBSource` instance starts playing.

###### RB.ShellPlayer::playing-uri-changed

Emitted when the playing database entry changes, providing the URI of the entry.

###### RB.ShellPlayer::window-title-changed

Emitted when the main window title text should be changed.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct RBShellPlayerClass {
      GObjectClass parent_class;
      void (* window_title_changed) (
        RBShellPlayer* player,
        const char* window_title
      );
      void (* elapsed_changed) (
        RBShellPlayer* player,
        guint elapsed
      );
      void (* elapsed_nano_changed) (
        RBShellPlayer* player,
        gint64 elapsed
      );
      void (* playing_changed) (
        RBShellPlayer* player,
        gboolean playing
      );
      void (* playing_source_changed) (
        RBShellPlayer* player,
        RBSource* source
      );
      void (* playing_uri_changed) (
        RBShellPlayer* player,
        const char* uri
      );
      void (* playing_song_changed) (
        RBShellPlayer* player,
        RhythmDBEntry* entry
      );
      void (* playing_song_property_changed) (
        RBShellPlayer* player,
        const char* uri,
        const char* property,
        GValue* old,
        GValue* newValue
      );

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`window_title_changed: void (* window_title_changed) ( RBShellPlayer* player, const char* window_title )`

  No description available.

`elapsed_changed: void (* elapsed_changed) ( RBShellPlayer* player, guint elapsed )`

  No description available.

`elapsed_nano_changed: void (* elapsed_nano_changed) ( RBShellPlayer* player, gint64 elapsed )`

  No description available.

`playing_changed: void (* playing_changed) ( RBShellPlayer* player, gboolean playing )`

  No description available.

`playing_source_changed: void (* playing_source_changed) ( RBShellPlayer* player, RBSource* source )`

  No description available.

`playing_uri_changed: void (* playing_uri_changed) ( RBShellPlayer* player, const char* uri )`

  No description available.

`playing_song_changed: void (* playing_song_changed) ( RBShellPlayer* player, RhythmDBEntry* entry )`

  No description available.

`playing_song_property_changed: void (* playing_song_property_changed) ( RBShellPlayer* player, const char* uri, const char* property, GValue* old, GValue* newValue )`

  No description available.

#### Virtual methods

###### RB.ShellPlayerClass.elapsed_changed

No description available.

###### RB.ShellPlayerClass.elapsed_nano_changed

No description available.

###### RB.ShellPlayerClass.playing_changed

No description available.

###### RB.ShellPlayerClass.playing_song_changed

No description available.

###### RB.ShellPlayerClass.playing_song_property_changed

No description available.

###### RB.ShellPlayerClass.playing_source_changed

No description available.

###### RB.ShellPlayerClass.playing_uri_changed

No description available.

###### RB.ShellPlayerClass.window_title_changed

No description available.