mmr_list_change()

Updated: April 19, 2023

Set a new playlist

Synopsis:

#include <mm/renderer.h>
int mmr_list_change(mmr_context_t *ctxt,
                    const char *url,
                    int delta)

Arguments:

ctxt
A context handle
url
The URL of a new playlist
delta
The difference in the current track's position in the two lists

Library:

mmrndclient

Description:

Set a new playlist without interrupting playback. This function can be used only during playback of a playlist (including when it's paused, but not stopped).

The new playlist must contain the currently playing track at position n+delta, where n is its position on the old playlist and delta is the difference in its position in the two lists. This last value is signed, so it can be negative.

Returns:

Zero on success, -1 on failure (use mmr_error_info())

Common errors returned by this function and recommended follow-up actions are:

MMR_ERROR_INVALID_STATE
The context was stopped when not playing. The playback might have reached the end of the old playlist and so it was too late to switch playlists without interrupting playback. To fix, attach the new playlist as an input, seek to the beginning of the appropriate track, and start playback.
MMR_ERROR_INVALID_PARAMETER
The indicated location in the new list (n + delta) is out of range or refers to a different URL. This error could be caused by a stale delta value, which results when the track you thought was playing just ended and a different track is playing now. To fix, recompute the difference between the position of the current track on the two lists.