DMediaControl

From Dabo Wiki
Jump to: navigation, search

dMediaControl is used to incorporate video or audio content into your application. It can play all of the most common formats: .mov, .avi, .mpeg for video; .mp3, .aiff, .wav for audio.


Some of the more useful properties for dMediaControl:

  • Source - (str): This is either the path to the file on disk that contains the content to be loaded into the control, or a URI for the content on the internet. Setting the Source property loads the content into the control.
  • TimeInSeconds - (bool): When True, the Duration and CurrentPosition values are specified in seconds; when False, milliseconds. Default=True.
  • CurrentPosition - (int/float): The position in the playback of the content, in either seconds (default) or milliseconds, depending on the value of TimeInSeconds.
  • Duration - (int/float): The length of the content, in either seconds (default) or milliseconds, depending on the value of TimeInSeconds. Read-only.
  • Volume - (int): Used to set the sound volume of the media. Ranges from 0 (silent) to 100 (full volume).
  • PlaybackRate - (int): Used to control the speed at which the media is played. A rate of 100 represents normal; 200 would play the media at double-speed; 50 at half-speed. Negative values cause the media to play in reverse.
  • ShowControls - (bool): The media players used on each platform have built-in controls to handle playback, volume, etc., which are displayed when this property is True and hidden otherwise (if you want to supply your own controls). Default=True.
  • Loop - (bool): Controls whether the content automatically restarts from the beginning when it reaches the end. Default=False.
  • Status - (str): The current state of the control; one of either "Playing", "Paused" or "Stopped". Read-only.

Some of the more useful events for dMediaControl:

  • MediaLoaded - Raised when content has been successfully loaded into the control.
  • MediaStateChanged - Raised when the Status of the control changes.
  • MediaPlay - Raised when the media begins playing.
  • MediaPause - Raised when the media is paused.
  • MediaStop - Raised when the media is stopped.
  • MediaFinished - Raised when the media reaches the end of its content.

See the Dabo Class Documentation for an exhaustive documentation of this control's Properties, Events and Methods. (Note that this documentation is no longer live, but it's still available via the Internet Archive).