company logo

_uc_MediaPlayer - Audio and Video Player

The _uc_MediaPlayer supports playing audio and video streams. In order to use the _uc_MediaPlayer with Qt (>=4.7 && <5.0) and the 'Phonon back end Plugins (QTDIR/plugins/phonon_backend)' have to be installed.

The data source for the player is a string property handle, which contains the complete file path to be played. The file path may contain option variables enclosed in %...%, which are resolved by the control. After changing the value in the control property handle, one may call ControlContext ::refresh() in order to signal that the property handle content has changed.

The media player control sends following string messages to the control context class:

  • auto - is submitted after finishing an audio or video file. The context may decide, whether to continue with the next file or do any other action
  • next - is a request for next video or audio file.
  • previous - is a request to start the previous audio or video file.
    • autoPlay - returns the current state of the auto play feature ( autoPlay:enable or autoPlay:disable ).
  • metadata - returns metadata about artist and title as " metadata: artist ; title ". The message is send after starting to play a title, but also as reponse to a metadata question (see communication below).
  • status - returns the current media status for the player as: " status:loading ". Values returned are:
  • empty
  • unknown
  • loaded
  • loading
  • buffering
  • buffered
  • stalled
  • end
  • invalid
  • state - returns the current player state as " status:play ". Values returned are:
  • play
  • pause
  • stop

The application may send following commands to the media player:

  • enable - enable feature passed as parameter ( enable:video or enable:audio )
    • autoPlay - allows changing the current state of the auto play feature ( autoPlay:enable or autoPlay:disable ).
  • playListAdd - add file to play list ( playListAdd:filename )
  • playListClear - clear play list
  • state - allows changing the player state. The new state is passed as parameter ( state:play , state:pause , state:stop )

Communication commands are used in order to send messages that require a reply from the media player. In order to communicate, the application has to send a command to the media player:

mplayer_ctx.message("state");

In case of communication command the player returns a message, which may be received by the doMessage() handler, which is a bit tricky, since the answer is not directly send to the one who is asking.

  • status - returns the current media status via the doMessage() handler. For possible values see status message above.
    • state - sending a state message without parameters to the media player returns the current media player state via the doMessage() handler. For possible values see state message above.
    • autoPlay - sending an autoPlay message without parameters to the media player returns the current state of the auto play feature. For possible values see autoPlay message above.
    • metadata - returns the current media metadata (title and artist) via the doMessage() handler. For possible values see metadata message above.
  • playListAdd - add file to play list ( playListAdd:filename )
  • playListClear - clear play list