Configuring Playback

This chapter explains how to configure the MME's playback behavior. It includes:

Playback configuration elements

All playback configuration elements are under the <Playback> element. The table below lists these elements. For simplicity, the <Playback> element is included in the table.

Element Attributes Default Description
<Playback> played_count “end” Configure how the MME increments the number of times a track has been played. See Configuring how plays are counted below.
<AtEndOfSeek> play Set MME behavior at end of a seek operation. This element can be set to either “play”: play forward, or “seek”: continue seeking. Note that devices, such as iPods, that manage their own track sessions may not honour this setting.
<ConsecutivePlayErrorsBeforeStop> 5 Set the number of consecutive times the MME will attempt to initiate playback of different tracks in a track session count before it reports a tracksession failure. See Configuring track session failure settings below.
<DeviceRemovalSavesState> true If this option is enabled, the MME automatically saves the track session state when a mediastore is removed during playback. With this option enabled, there is no need to call mme_trksession_save_state() after receiving an MME_PLAY_ERROR_DEVICEREMOVED event.
<SkipUnplayable> enabled false If this option is enable, the MME automatically skips files marked as unplayable without sending an error message. See Automatically skip files marked as unplayable below.
<TrksessionViewAutoWrite> true Determines if the MME automatically writes track session views to the database, or if keeps them in memory and writes them out only when specifically requested to do so by a call to mme_trksessionview_writedb().
<TrksessionViewDelayAfterWrite> 0 The time, in milliseconds, to delay after finishing writing to the trksessionview table.
<TrksessionViewWriteSize> 1000 Set the number rows that the MME writes or deletes from the trksessionview table at at time. See Setting the number of tracks written to the trksessionview table below.

Playback constants

The table below lists the default playback management constants.

Constant Value Description
CONFIG_DEF_PLAY_AT_END_OF_SEEK 0 Behavior at the end of seek. Default is play (0). Non-zero means continuing seeking in the same direction.

Configuring playback behavior

This section describes how to use the playback configuration elements and their attributes to set playback behavior.

Setting the number of tracks written to the trksessionview table

The element <Playback>/<TrksessionViewWriteSize> sets the number of rows (IDs of tracks in the track session) that the MME writes or deletes from the trksessionview table at at time. The more rows the MME writes at a time, the better the MME performance for track changes during playback, but the longer the trksessionview table will be locked when it is updated.

Configuring track session failure settings

The element <Playback>/<ConsecutivePlayErrorsBeforeStop> sets the number of consecutive times the MME will attempt to initiate playback of different tracks in a track session count before it delivers the event MME_EVENT_FINISHED_WITH_ERROR to report a playback failure requiring action by the client application.

Note that if the number of tracks in a track session or, if in repeat mode, the number of tracks to repeat is less that the value of <ConsecutivePlayErrorsBeforeStop>, the MME will count to the lesser value before reporting the track session failure. For example, if repeat mode is set to MME_REPEAT_SINGLE and <ConsecutivePlayErrorsBeforeStop> is set to 5, the MME will deliver the MME_EVENT_FINISHED_WITH_ERROR event after it has failed to play the one track it has been asked to repeat. It will not make five attempts to initiate playback of the same track.

Incrementing the error count

The MME increments the consecutive play error count if:

Resetting the error count

The MME resets the consecutive play error count if a client:

Configuring seek mode

You can configure how the MME behaves when mme_play_set_speed() reaches the end of a track. If <AtEndOfSeek> is set to seek, the seek operation is continued through to the next or previous track in the track session. If there is no next or previous track, seeking stops. If <AtEndOfSeek> is set to play, in a forward seek operation, once the end of the current track is reached, the MME begins playing the next track in the track session at normal speed. In a reverse seek operation, when the beginning of the current track is reached, it is played at normal forward speed.

Playback pre-queuing

The MME offers playback pre-queuing. When playback pre-queuing is implemented, the MME indicates to the io-media-* component playing the current track the next track it should play before it finishes, so that io-media can reduce to a minimum any gap between tracks.

Support for playback pre-queuing depends on the specific io-media-* component used to play tracks. The io-media mmf_graphbuilder module, for example, uses the pre-buffer option to set how much of the next graph it builds between the time the currently used graph has finished reading a track and the time it finishes playback. For more information, see mmf_graphbuilder options” on the io-media page of the MME Utilities Guide.

Playback pre-queuing is enabled in the MME by default; when it is enabled, io-media implements playback pre-queuing according to its settings.

If you playback pre-queuing is not supported by the io-media-* component used to play tracks, the MME does not tell io-media what track it wants to play after the currently playing track has finished. It waits until io-media announces that it has completed playback of the current track before requesting playback of a new track.


Note: Playback pre-queuing affects autopause behavior. For more information, see mme_setautopause().

Automatically skip files marked as unplayable

The <SkipUnplayable> element configures the MME's behavior when it encounters a file marked as unplayable. The default setting for this element is false: attempt to play all files and handle errors according to the error handling configurations.

To configure the MME to skip files that have been previously marked as unplayable, set the <SkipUnplayable> element's enable attribute to true. With this configuration, the MME treats unplayable files as though they did not exist. It:


Note:
  • Unplayable files are visible in the track session view if they match the select statement used to populate the the track session.
  • You can have your client application filter out files marked as unplayable by including the clause WHERE playable=1, in the SQL SELECT statement you use to build your library-based track sessions.

See also Marking unplayable files in the MME Developer's Guide chapter Playback Errors.

Configuring how plays are counted

The playback includes an attribute that allows you to set how the MME increments the number of times a track has been played and records it in the fullplay_count column of the library table.

This attribute, played_count can be set to any of the following values:

The default value for played_count is “end”.

Configuring Digital Rights Management (DRM)

The MME's PlaysForSure (PFS) module iofs-pfs supports Microsoft's Windows Media DRM 10 for WMA content on PFS devices. If you will use DRM-enabled devices on your system, you should start io-fs with the drm option, so that it checks for the required files and exits if it does not find them. This strategy ensures that the MME does not fail when it attempts to playback DRM-protected media. For more information, see iofs-pfs.so in the MME Utilities Reference.