Using the service from client applications

Updated: April 19, 2023

To play or record media content, an application must configure the mm-renderer service by defining a context, specify an input and one or more outputs, configure any necessary parameters, and begin issuing playback commands.

From client applications, the general flow of mm-renderer operations is:
  1. Connect to mm-renderer by calling mmr_connect().
  2. If you want to define a new context, call mmr_context_create(), passing in the connection handle returned by the connection function, and also a context name.

    Depending on your application needs and mm-renderer configuration, you may prefer to open an existing context by calling mmr_context_open(). See Working with contexts for more details.

  3. Attach at least one output using mmr_output_attach(). For this function call and the subsequent ones used to define media flow and control playback, you must pass in the context handle returned by the function called in the second step.

    If the media content you want to play has multiple components, you must call the output attachment function for each one. For example, to play a movie, you would call this function once to define where to direct the audio output and then again to define the video output device.

  4. Attach the input using mmr_input_attach(). In this call, you must provide the input type (e.g., track or autolist) and the URL to name the location of the media source.
  5. Configure any parameters needed to optimize mm-renderer to play the specific content. You can set context, output, input, and track parameters.
  6. Issue media playback commands. The playback control functions let you start and stop playback, and more.
  7. Repeat the second through sixth steps as needed to play more media streams in different contexts and hence, independent playback zones. Note that it is up to the application to handle conflicting playback situations; mm-renderer can't do this.

When your application is finished using a context, it should call mmr_context_close() to free the context's resources. Depending on the mm-renderer configuration and the handle passed in, this function might also destroy the context. Or, you may need to wait until you know the context isn't being used anymore and explicitly call mmr_context_destroy(). See Closing context handles for a description of the different handle types and the cases when mm-renderer destroys a context.

When it's finished using mm-renderer altogether, the application should disconnect from the service by calling mmr_disconnect().