The following mmrplay commands demonstrate common use cases of playing or recording media files. The media files accessed here are encoded in popular formats such as MP3, M4A, and WMA, but all mmrplay commands have the same syntax and support the same options, regardless of the file format.
In these examples, the input URLs are pathnames in the local filesystem. These can be the paths of uploaded files or files stored on connected devices. When you attach a mediastore to your system, the device publisher that monitors devices of the relevant type will publish its mountpoint to a PPS object in /pps/qnx/mount/. For instance, when you plug in a USB stick, the usblauncher service assigns it a mountpoint of /fs/usb0 (or something similar). For information on how the publishers assign mountpoints and publish device information, see the Device Publishers Developer's Guide.
The mmrplay commands automate the tasks of attaching outputs and inputs and configuring their parameters, which must be done in separate mm-renderer API calls before you can play media files. For examples of all mm-renderer actions needed to configure and control media file playback, see "Using mmcli to play media files".
# mmrplay /fs/usb0/stillness_in_time.mp3
This command doesn't name an audio output URL using -a, so mmrplay will output the media file to the default audio device. In this case, an output URL of audio:default is sent to mm-renderer, which makes it use automated audio routing with the Audio Manager service. If mm-renderer doesn't accept this URL, mmrplay then sends it the device pathname of the preferred audio device (e.g., /dev/snd/pcmPreferredp). If mm-renderer can't use this device either, the command fails.
# mmrplay -A volume=30 -t track /fs/usb0/stillness_in_time.mp3
The output device is independent of the input format, so you would use the same command syntax to play other audio file types (e.g., WMA, WAV), except that your input URL would contain a different file extension.
# mmrplay -t playlist -I repeat=none /fs/usb0/u2_best_of_80s.m3u
This command sets the repeat mode to none to prevent mm-renderer from continuously playing either a single track or the entire set of tracks in the playlist. If you set a different repeat mode (e.g., all), mmrplay would initiate playback in mm-renderer but then wait indefinitely for the playback to stop (because it would never receive an event indicating that playback has stopped).
# mmrplay -c test_playlist_looping -t playlist -I repeat=all \ /fs/usb0/u2_best_of_80s.m3u
Here, mmrplay creates a context called test_playlist_looping and starts continuous playback of the entire track set in the u2_best_of_80s.m3u playlist. To stop playback in an application or mmcli, you must connect to mm-renderer (using mmr_connect()), open the test_playlist_looping context (using mmr_context_open()), and then stop playback (using mmr_stop()). For details on working with mm-renderer, see the Multimedia Renderer Developer's Guide.
# mmrplay -v screen: /fs/usb0/seven_days_live.mp4
Here, the video output URL has a prefix of screen: to tell mm-renderer to output the video stream to the Screen Graphics Subsystem, which renders it to the display. You can set some properties of the output window in this type of URL, as explained in the mmr_output_attach() function reference.
# mmrplay -a "" -v screen: /fs/usb0/seven_days_live.mp4
To record audio content to a file, enter a command like this:
# mmrplay -c test_audio_recording -f /tmp/my_karaoke.wav \ snd:/dev/snd/pcmPreferredc?frate=44100&nchan=2
This command directs the audio output to a WAV file specified by -f. Here, the input URL names the preferred audio capture device and sets parameters for the sampling rate (frate) and the number of channels (nchan). You can find a list of all supported parameters for this URL type in the mmr_input_attach() reference.
Similar to playing a playlist with the repeat mode enabled, recording audio content causes mmrplay to initiate playback with mm-renderer but to never process an event indicating playback has stopped. If you start recording audio with mmrplay, you must then explicitly stop the recording by stopping playback in the relevant context, by either directly calling the mm-renderer API or using mmcli.