Playing and Recording Media Content

The mm-renderer service lets you play individual audio or video tracks as well as playlists. For video playback, you can add subtitles and send the video to a specific display area. You can also record audio content. Each use case follows a similar API usage pattern but differs in terms of specific calls and parameters that you must set.

Using the service from client applications

From client applications, the general flow of operations for playing and recording media content 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 first API function. You must also provide 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 an explanation about creating and opening contexts.

  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 second API function.

    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 playlist) 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, stop, and change the speed of playback, and more.
  7. Repeat the second through sixth steps as needed to play more media streams in different contexts and hence, create 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().