Playing Media

This chapter describes how to work with track sessions and play audio media on the MME.

About playing media with the MME

The MME is designed to facilitate development of a user-friendly, efficient, and versatile HMI for playing diverse media. A client application can instruct the MME to begin playing media from a mediastore even before the mediastore has been synchronized with the MME database. However, most client applications will start synchronizing a mediastore before starting playback, so they can provide metadata, such as song artist and genre, to their end users.

To play media through the MME, the client application requires:


Note:

Working with track sessions

About track sessions

A track session is the basic unit for playing media. It is created by an SQL query or an explorer API function that generates a list of media tracks that can be played in a control context. Each track in a track session is identified by its zero-based offset in the list; this method permits duplicate file IDs (fids) in a track session.

To play media, the client application must:

  1. Create a track session by calling mme_newtrksession(). This function delivers the track session ID, which the client application can use to:
  2. For track sessions that use media from unsynchronized mediastores (file-based track sessions), use the explorer API to discover and add track sto the track session. For more information, see the chapter Unsynchronized Media in this guide. This step is not needed for track sessions that use media from synchronized mediastores (library-based track sessions), because for these types of track sessions, the call to mme_newtrksession() populates the track session with the tracks to be played.
  3. Set the track session by calling mme_settrksession(). Once a track session is set, the client application can begin playback or perform other operations, such as fast-forwarding, setting the random or repeat mode, and so on
  4. Start playback, by calling mme_play(), or another function.

Note:
  • The MME supports multiple track sessions; to determine which is the current track session, call mme_trksession_get_info().
  • A track session can not be used by more than one control context. If you attempt to set a track session already in use by another control context, mme_settrksession() returns -1 and sets errno to EINVAL. To pass control of a track session to a new control context, you must first release it from the current control context by calling mme_settrksession() with trksessionid set to 0 (zero).

For more information about the fields in the track session table, see the trksessions table entry in the appendix: MME Database Schema Reference of the MME API Library Reference.

Types of track sessions

The MME supports two types of track sessions:

Library-based track sessions

A library-based track session is built with files from mediastores that have been synchronized and, therefore, have entries in the library table in the MME database. To create a library-based track session, simply proceed as with previous releases, calling mme_newtrksession() with the mode argument set to MME_PLAYMODE_LIBRARY (0).

The figure below illustrates the flow of activities from the creation of a track session to the end of the track session, with a mediastore synchronization in the background.


Playback workflow


Playing media with the MME.

File-based track sessions

A file-based track session is a track session built with files discovered through the the MME's explorer API. Unlike tracks in a library-based track session, tracks in a file-based track session can be from unsynchronized mediastores and do not, therefore, have to have entries in the library table. For more information about the MME's explorer API, see the chapter Unsynchronized Media in this guide.

Track sessions and playlists

The difference between a track session and a playlist, is that a playlist is an arbitrary collection of tracks that is created by a user, either by selecting individual songs or by creating some selection criteria (such as all the songs by a particular artist), represented as an SQL statement. The user can name a playlist and store it. A playlist isn't associated with a control context.

To play a playlist, the client application creates a track session from the playlist and associates that track session with a control context. Set the track session with the playlist to be the current track session by calling mme_settrksession(). For more information about playlists, see the chapter Playlists.

Creating track sessions

Your application should create either a library-based track session or a file-based track session, depending the synchronization status of the mediastore with the media to be played:


Note: MME track sessions support duplicate file IDs (fids), because the MME references tracks in track sessions by their offsets, not their fids. To start playback with a specific track offset in a track session, use mme_play_offset().

Creating library-based track sessions

Library-based track sessions are used for playing found on synchronized mediastores, and are the most commonly used type of track session.

To create a library-based new track session, call mme_newtrksession() with an SQL statement to select the tracks you want to play and the mode argument set to MME_PLAYMODE_LIBRARY (0). This function will use your query statement to:


Caution: Always use MME functions to update the trksessions table. Never write directly to this table. If you write directly to this table, you will make its data unreliable.

Below are some examples of how your client application could create a library-based track session and play it. To keep things simple, these examples assume that you have already connected to the MME database and MME resource manager, and they don't check return codes, which your application should do.

Playing all tracks in the MME library

We can start with the simplest case: create a track session to play all the tracks in the library. This case has the following steps:

  1. Create a track session that includes all audio tracks from all available mediastores in the library.
  2. Set this track session as the active track session in the current control context.
  3. Play all tracks in the track session, in the alphabetical order of the titles.

Since we are not interested in metadata or playlists, we can start playing tracks from any new mediastores after only the first synchronization pass has completed on these stores.

mme_hdl_t   *mme;
char        *sql;
uint64_t    trksessionid;

mme = mme_connect("/dev/mme/default", 0);        // Connect to MME
sql =   "SELECT library.fid AS fid FROM library "
        " INNER JOIN mediastores ON mediastores.msid = library.msid "
        " WHERE mediastores.available=1 AND ftype=1 "
        " ORDER BY title";

// create the new track session
mme_newtrksession( mme, sql, MME_PLAYMODE_LIBRARY, &trksessionid );

// set the new track session as the active track session
mme_settrksession( mme, trksessionid );

// start playing the track session,
// pass in a fid of 0 to start from the beginning.
mme_play(mme, 0);

Note that:

For more information about the SQL queries used with the MME and QDB as well as recommendations, see the chapter Working with the MME Database and SQL.

Excluding mediastore fids from track sessions

The MME adds a fid to the library table for many types of mediastores, including iPods and type MME_STORAGETYPE_DEVB mediastores (which includes HDDs, USB sticks, CDs and DVDs).

When composing queries for a track session, you should exclude fids that refer to mediastores by adding a WHERE clause to the query statement to select the file type entry (ftype) you need. For example to select only entries where ftype=FTYPE_AUDIO:

SELECT fid, ftype, title FROM library WHERE ftype=1 ORDER BY title;

Creating and modifying file-based track sessions

File-based track sessions are used for playing found on unsynchronized mediastores.

To create a file-based track session:

  1. Use the MME's explore API functions (mme_explore_*(), etc.) to explore a mediastore and retrieve information about tracks of interest on the mediastore.
  2. Create a file-based track session by calling mme_newtrksession() with the mode argument set to MME_PLAYMODE_FILE (1).
  3. Set the track sesssion by calling mme_settrksession().
  4. Call one of mme_trksession_append_files() or mme_trksession_set_files() to add files to the track session.
  5. Proceed with playback and other functionality as with library-based track sessions.

Note: You don't need to use the explorer API before you create or set the track session. You can use it at any time to discover tracks of interest, which you can then add to your track session using one of the methods described below.

Modifying a file-based track session

You can explore mediastores and add tracks to your track session at any time after creating the track session, or after you have started playback. You can change an existing file-based track session by:

Setting track sessions

After you have created a track session, you must set it by calling mme_settrksession(). When you call mme_settrksession(), the MME takes a snapshot of the SQL statement that represents the track session and stores it in the trksessionview table. This entry in the trksessionview table changes only when a new track session is set, or if you call the function mme_trksessionview_update().

Setting a track session before synchronization has completed

If a client application sets a track session before the MME has completed the first synchronization pass of a mediastore (before it receives the event MME_EVENT_MS_1PASSCOMPLETE), the track session contains only a subset of the data available on the mediastore. For example, if the client application calls mme_settrksession() before it receives the event MME_EVENT_MS_1PASSCOMPLETE, the track session it sets will contain only those tracks that were synchronized up to that point; the remaining tracks on the mediastore will not be included in the track session.


Caution: If the SQL SELECT statement used to create the track session uses metadata, the client application has to wait for the event MME_EVENT_MS_2PASSCOMPLETE before making its final update to the trksessionview table. For example, SELECT fid FROM library WHERE artist_id=4 AND msid=3 uses metadata, so all fids for the track session will not be found until after the second synchronization pass is complete. However, a query such as SELECT fid FROM library WHERE msid=3 ORDER BY filename uses only information provided by the first synchronization pass, so all fids for the track session are found by the first synchronization pass.

To enable playback as quickly as possible while ensuring that all requested tracks are included in the track session, the client application should update the trksessionview table when it knows that the first syncrhonization pass has completed, and, for large mediastores that can take a long time to synchronized fully, periodically so that the track session does not run out of tracks. For example, with a large mediastore with 10,000 files, the client application can do something like the following, assuming that synchronization was started automatically, and that the SQL SELECT statement does not use metadata:

  1. Create the track session (mme_newtrksession()).
  2. MME_EVENT_MS_SYNCFIRSTFID received: set the track session (mme_settrksession()) with one fid.
  3. Start playback (mme_play(), then mme_resume_state()).
  4. Refresh the data in the trksessionview table (mme_trksessionview_update()).
  5. If MME_EVENT_TRKSESSIONVIEW_INVALID is received, loop until MME_EVENT_TRKSESSIONVIEW_UPDATE is received, indicating that the MME has begun updating the trksessionview table in the background.
  6. At one minute intervals, update the data in the trksessionview table (mme_trksessionview_update()) until the event MME_EVENT_MS_1PASSCOMPLETE is received. When this event is received, refresh the trksessionview table one last time.

Note:
  • Updates of the trksessionview table may take several seconds. It is best to keep these to a minimum. Full playback capabilities are available while the MME performs these updates.
  • The MME writes blocks of entries to the trksessionview table in the background. The size of this block is configurable. See Setting the number of tracks written to the trksessionview table in the MME Configuration Guide. When it finishes writing a block of entries, the MME delivers the event MME_EVENT_TRKSESSIONVIEW_UPDATE. When it finishes writing entries for all available tracks (tracks that have been synchronized thus far), the MME delivers the event MME_EVENT_TRKSESSIONVIEW_COMPLETE.
  • Delivery of the event MME_EVENT_TRKSESSIONVIEW_COMPLETE means only that there are no more entries for tracks to be written to the trksessionview table. When synchronization completes its first pass, you will need to call mme_trksessionview_update() again to update the trksessionview table.
  • Metadata for all tracks in the track session is not available until synchronization has completed its second pass and delivered the event MME_EVENT_MS_2PASSCOMPLETE.

Clearing track sessions

You can clear a track session by:

  1. calling mme_stop() to stop the track session
  2. calling:

Deleting track sessions

To prevent a track session “leak” — an accumulation of useless track sessions in the trksessions table — you should delete track sessions from the trksessions table in the following circumstances:

To delete a track session:

  1. Call mme_stop() to stop playback on the track session.
  2. Call mme_settrksession() with the trksessionid set to 0 (zero) to clear the track session.
  3. Call mme_rmtrksession() to delete the track session.

Monitoring and managing playback

After you have started playing a track session, you need to monitor the progress of the playback by checking the MME playback events. The example below shows a client application displaying messages on receipt of some MME events:



switch (msg.single.type) {
    case MME_EVENT_NONE:
        fprintf(stderr, "Received MME_EVENT_NONE (%d)\n",  MME_EVENT_NONE);
        break;
    case MME_EVENT_TIME:
        fprintf(stderr, "Received MME_EVENT_TIME (%d)\n",  MME_EVENT_TIME);
        break;
    case MME_EVENT_FILECHANGE:
        fprintf(stderr, "Received MME_EVENT_FILECHANGE (%d)\n",  MME_EVENT_FILECHANGE);
        break;
    case MME_EVENT_PLAYLIST:
        fprintf(stderr, "Received MME_EVENT_PLAYLIST (%d)\n",  MME_EVENT_PLAYLIST);
        break;
    ...

    default:
        fprintf(stderr, "Unknown Event Received (%d)\n",  msg.single.type);
        break;
}

Setting the playback notification interval

While the MME is playing a track session, it delivers the event MME_EVENT_TIME at set intervals to notify the client application of playback progress.

The default interval between deliveries of MME_EVENT_TIME is 100 milliseconds, but the MME allows you to change this interval by calling mme_set_notification_interval() with the time set to the desired interval, in milliseconds.

Note that:

You should monitor for events indicating errors, changes in tracks (so you can display the metadata display, for example), completion of playback, etc. For a complete list of playback event types, see Playback events in the chapter MME Events.

You can also check on the progress of the playback by calling mme_play_get_status(). This function retrieves the status of playback, providing the total play time of the track and the play time elapsed.

Knowing when playback has ended

In most environments, users want to continue playback without interruption until they explicitly request a change. Therefore, once the MME has started playback of a track session, it continues playback until:

In short, once playback of a track session has started, the client application doesn't need to do anything except monitor MME events, and pass information and metadata to the end user, until it receives one of these events:

Both these events indicate that playback has stopped, and that action by the client application is required for playback to resume. No other events (not even MME_PLAY_ERROR_* events) require action from the client application for playback to continue.


Note: If the client application instructs the MME to stop playback (e.g. by calling mme_stop()), the MME does not deliver an MME_EVENT_FINISHED_* event.

Using random and repeat modes

The MME can set the playback mode of a library-based track session to play through the track session sequentially, repeat the track being played, repeat the entire track session, or play through the track session in random order.

Track sessions inherit their repeat and random modes from the control context in which they are created. Use the functions mme_getrepeat() and mme_setrepeat(), and mme_getrandom() and mme_setrandom() to get and set these modes.


Note:
  • For both library-based and file-based track sessions, a call to mme_trksessionview_update() refreshes the pseudo-random order of the tracks in the track session.
  • iPods maintain their own random and repeat modes, which the MME can detect and set. For more information, see Using random and repeat modes on iPods in the chapter Working with iPods.

Repeat and random modes with file-based track sessions

The explorer API and file-based track sessions are designed to allow the client application to manage its track sessions, discovering tracks and adding new tracks to a track session a few at time, as required by the end-user.

When new tracks are added to a track session in random mode, the new tracks are appended in pseudo-random order to the end of the track session; they are not integrated into the pseudo-random order for the entire track session. For example, if five tracks are added to a track session with 20 tracks, the order for the tracks in positions 0 to 19 remains the same, and the new tracks are appended in pseudo-random order in postions 20 to 24.

When playing tracks in a file-based track session, to change the next track that will be played without interrupting the track currently being played, the client application can call mme_trksession_set_files() with the offset parameter set to the required track.

Starting playback from a specific track

The MME lets you start playback with a specific track from a track session. The method for starting playback from a specific track is different for library-based and file-based track sessions.


Note: The MME can play a track that isn't in the current track session, as long as it has an active track session in the current control context. For more information, see mme_play().

Library-based track sessions

To start playback with a specific track in a library-based track session, instead of passing mme_play() a 0 (zero) for the fid argument, which starts playback with the first track in the track session, pass it the fid of the track you want to play. The MME will start playback with the track you specified, then continue playing the track session as determined by the position of the track in the track session and the random and repeat mode settings for the control context. For example:


Note: If the library-based track session contains more than one instance of the specified fid, the MME starts playback at the first instance of this fid.

File-based track sessions

To start playback from a specific point in the file-based track session, use mme_play_offset(), passing it the zero-based offset of the track where you want to start playback. For example, to start playback with the 17th track in the track session set the mme_play_offset() function's offset argument to 16.

Playing a track not in the current track session


Note: The MME can play a track that isn't in the current track session, as long as it has an active track session in the current control context. For more information, see mme_play().

Pausing playback

Your client application should pause playback only in situations when it expects to resume playback or tear down the track session after a brief interval, such as when the end user sends a “pause” button command (MM_BUTTON_PAUSE) through the HMI. For situations when you expect a change to the system, such as a shutdown or a change to the mediastore being played, you should save the track session state and stop the track session. For more information, see Stopping and resuming playback below.

To pause playback temporarily, call mme_play_set_speed() with the speed set to 0. This action pauses playback until you call mme_play_set_speed() again with the speed set to something other than 0 (zero). Normal playback speed is 1000. For more information about how to use mme_play_set_speed(), see Using fast forward and reverse below.

Stopping and resuming playback

Your client application should save the track session state and stop the track session when it expects or encounters a system change, such as a shutdown or a change to a mediastore. Such situations include, but are not limited to, the following:

The operations required to stop then resume playback are a function of the capabilities of the device with the media tracks for the track session. These devices can be:

For information about resuming playback when using the explorer API, see Pausing and resuming playback in a file-based track session below.

Resuming playback

If you want to stop, then resume playback of a track session on a device or devices that don't manage their own track session, you must:

  1. Stop the track session:
    1. Call mme_play_set_speed() with the speed set to 0 (zero) to pause the track session.
    2. Call mme_trksession_save_state() to save the play position and other information, such as the track session ID, about the track session.
    3. If you plan on using mme_play_resume_msid() to resume playback, call mme_set_msid_resume_trksession() to set the mediastore ID to be used by mme_set_resume_msid().
    4. Stop the track session by calling mme_stop().
  2. Do something else, such as switch to another activity or shut down the system.
  3. Resume the track session:

    Method A (works only for devices and mediastores that don't support their own track sessions):

    1. Call mme_settrksession() to reset the track session.
    2. Call mme_trksession_resume_state() to resume playback of the track session.

    Method B (works for all devices and mediastores):

    1. Call mme_play_resume_msid() to resume playback of the track session (equivalent to calling mme_settrksession(), then mme_trksession_resume_state()).

Stopping and resuming a track session.


Stopping and resuming an MME-controlled track session.

The strategies described below allow your client application to call mme_trksession_resume_state() to resume playback at a later time at exactly the position where it was stopped.

Saving the track session state with mme_trksession_save_state() before stopping it assures that, when you resume playback, the MME has all the information it needs to start playing the correct track at the correct position.

Pausing the track session before saving its state ensures that when playback resumes, it will be exactly at the correct position in the track: the user will not hear the last few milliseconds of music played if there is a delay between the call to mme_trksession_save_state() and the call to mme_stop(). If you do not pause the track session before saving its state, a situation like the following may occur:


Note:
  • Saving the track session state with mme_settrksession() and resuming it by calling mme_set_msid_resume_trksession() is intended for handling situations such as system shutdowns or mediastore changes. You can not save the track session state, continue using the track session, then attempt to resume it.

    In short, once you have saved the track session state you must stop using that track session until you are ready to resume it. If you want to mark a place in a track session, continue playback or do some other activity, then resume playback at the point you marked, use the MME's bookmark functions. For more information, see Bookmarking tracks below.

  • Calling either mme_settrksession() or mme_set_msid_resume_trksession() regenerates the list of tracks used by the MME for playback in random mode (the entries in the randomid field of the trksessionview table).

Pausing and resuming playback in a file-based track session

Tracks in a file-based track session do not have corresponding entries in the MME library table. This particularity means that when stopping and resuming playback, the client application must take care of saving and restoring the file name and current time position for the track to be paused and resumed.

Pause playback in a file-base track session

To pause playback of a track in a file-based track session:

  1. Call mme_play_set_speed() with the speed set to 0 (zero) to pause playback.
  2. Save in a safe location;

Resume playback in a file-base track session

To resume playback of a track in a file-based track session, assuming that the track was passed as describe in Pause playback in a file-base track session above:

  1. Call mme_newtrksession() to create a new track session by with a device file ID (fid) for the mediastore with the track to be resumed.
  2. Call mme_settrksession() to set the track session.
  3. Call mme_setautopause() with the enable argument set to true to turn autopause on for the MME; with autopause enabled in the MME, when a track is played it begins in paused mode and remains paused until mme_play_set_speed() is called with the speed argument set to non-zero.
  4. Call mme_trksession_append_files(), with the filename argument pointing to the filename you saved when you paused playback, to add the paused track to the new track session so that it can be played.
  5. If your client application's connection is not O_SYNC; that is, if the MME does not completely execute requests before returning to the client, wait for the event MME_EVENT_PLAYAUTOPAUSED.
  6. Call mme_seektotime() with the time argument set to the current time position you saved before pausing the track.
  7. Call mme_play_set_speed() with the speed argument set to 1000 to resume playback at normal speed.

Using fast forward and reverse

Use mme_play_get_speed() to get the current playback speed of a track session (expressed in units of 1/1000 of normal speed). Use mme_play_set_speed() to pause, reverse, and playback more slowly or more rapidly than normal playback speed. Set the speed argument as shown in the table below:

Setting speed < 0 speed = 0 speed > 0 and < 1000 speed = 1000 speed > 1000
Action reverse at speed pause playback slow playback at speed normal playback fast playback at speed

Implementation note about fast-forward and fast-backward speeds

When setting fast-forward or fast-backward speeds, the requested speed can't be guaranteed for all devices. The graph used to play the track will select the supported speed closest to the one requested. The client application should use mme_play_get_status().

Some devices, such as iPods, do not maintain a constant fast-forward or fast-backward speed, but increase the speed according to the amount of time the fast-forward or fast-backward is maintained.

For devices with this behavior, there is no value in attempting to measure play time during a fast-forward or fast-backward. If you are testing with these devices, you can only ensure that fast-forward and fast-backward arrive at the end or beginning of a track faster with normal speed.

Fast-forward and fast-backward between tracks

Note that behavior when fast-forward or fast-backward move to a new track is:

Using seek to time, play at offset, and scan

To seek to a specific time in a track that is being played, use mme_seektotime(), passing it the time location to which you want to go and continue playback. For example, to skip ahead 15 seconds from the current position in a track, use mme_play_get_status() to get the current time location of the playback, then call mme_seektotime() with the current time location plus 15000.

Scan mode plays a track for a specified number of seconds, then moves to the next track, scanning all tracks in a track session. To use scan mode and set the time that the MME plays a track before moving to the next track, call mme_setscanmode() with the number of milliseconds you want to play each track before moving the scan to the next track. To get the current scan mode setting, use mme_getscanmode(). To turn scan mode off, call mme_setscanmode() with the time-to-scan argument set to 0 (zero).

Gapless playback

When gapless playback is enabled, if two tracks on the same mediastore use the same graph type, when moving from one track to the other, the MME attempts to minimize the silence between tracks.

To enable gapless playback, you need to start io-media with the appropriate arguments. For more information, see Configuring gapless playback in the MME Configuration Guide.

Viewing “previous” and “next” tracks

The MME stores information about tracks that have been played and will play in the track session in the trksessionview table. This information allows your client application to have the MME to move backwards through a track session, even if random play mode is enabled.

If random mode is off, playback advances through the tracks as they are listed in the sequentialid column of the trksessionview table. If random mode is on, playback advances through the tracks as they are listed in the randomid column of the trksessionview table. To view the previous or next tracks in a track session, use the file IDs listed before or after the current track in the relevant column.

Using play frequency statistics

The MME maintains information about how many times a track has been played. This count includes fast forwards through the track. The client application can use this information to build a most-popular or top-50 list.

The number of times a track has been played is maintained in the fullplay_count field of the library table.

Bookmarking tracks

The MME provides bookmarking capabilities that a client HMI can offer to end users. Bookmarks allow users to mark time locations on tracks in a track session and to resume playback from these locations. Bookmarks are recorded in the bookmarks table, and are identified by a bookmark ID (bookmarkid) and bookmark name (name), a mediastore ID (msid), and a track file ID (fid).

To view available bookmarks, query the bookmarks table. For example, to view all bookmarks for tracks on the current mediastore, where current_msid is the mediastore ID :

.
SELECT bookmarkid, fid, msid, name FROM bookmarks
    WHERE msid=current_msid ORDER BY name;

Use the functions mme_bookmark_create() and mme_bookmark_delete() to create and delete bookmarks, and mme_play_bookmark() to start playback from a specified bookmark.

Managing track sessions during playback

This section describes how to manage track sessions during playback.

Managing track changes across multiple mediastores

The MME performs track changes across different mediastores. This feature is supported by buffer level reporting. The MME provides the amount of time (milliseconds of playback) remaining in the MME buffer. Client applications can retrieve this information by calling the function mme_play_get_status(). This information gives device controllers a more accurate measure on which to base decisions to wake up devices, such as the system HDD.

Aborting blocking reads

Client applications can use the time left in the MME buffer to decide to abort blocking reads in order to skip to tracks on a mediastore other than the HDD. Aborting a blocking read allows the MME to fulfill a request to start playback of a track on another mediastore, such as a CD, immediately. It does not have to wait for its buffer to empty, or for the device controller to wake up the HDD.

Managing track sessions when a mediastore is removed

When a mediastore is removed from the system, the MME delivers the event MME_EVENT_MS_STATECHANGE, which carries the new state of the mediastore in mme_event_data_t.ms_state_change.new_state. If media on the mediastore is included in a currently playing track session, you can manage the change according to whether the track being played has been removed or is still on the system.

For example, if your track session includes tracks from both /fs/usb0 and /fs/usb1, and the track being played is on /fs/usb0:

Managing playback when the current mediastore is removed

If the track currently being played is on the removed mediastore, the MME delivers the event MME_PLAY_ERROR_DEVICEREMOVED, and stops playback:

Managing the track session if playback is not on the removed mediastore

If the track currently being played is not on the removed mediastore, the MME continues playback, and you can ensure that playback will continue uninterrupted to the end of the track session:

Switching playback to another track session

The MME supports seamless switching between track sessions; that is, changing playback from one track session to another without interrupting playback, if the new track session includes the track currently being played.

To seamlessly change track sessions during playback:

  1. Create a track session that includes the fid of the currently playing track.
  2. Call mme_settrksession() to set the new track session.

The MME will:


Note:
  • File-based track sessions are not permanent. Their contents are lost if playback is switched to another track session.
  • Calling mme_settrksession() regenerates the list of tracks used by the MME for playback in random mode (the entries in the randomid field of the trksessionview table).

For more information about MME behavior when switching playback between track sessions, see mme_settrksession() in the MME API Library Reference.