Media¶
Qualified name: delphifmx.Media
- class Media¶
Bases:
Object
Base class to access media files. TMedia is an abstract class that defines an interface for media files. Platform-specific subclasses provide concrete implementations for Windows and OS X platforms. TMedia exposes media file properties such as file name, size, dimension, state, or duration. The supported media files formats are the native formats for each platform:
For Windows: Audio formats: .wma, .mp3, .wav Video formats: .avi, .wmv For OS X: Audio formats: .mp3 Video formats: .mov, .m4v, .mp4 Using TMediaCodecManager, it is possible to register custom media codecs to extend the audio/video feature support. For easy access to media files, use the TMediaPlayer and TMediaPlayerControl components.
Methods
Frees the Wrapped Delphi Object
Returns True if Delphi Object is or inherits from ClassName
Starts the playback of the current media file.
Sets several properties in one call
Stops the playback of the current media file.
If the object is a container (TStrings, TComponent...), it returns the content of the sequence as a Python list object.
If the object is a container (TStrings, TComponent...), it returns the content of the sequence as a Python tuple object.
Attributes
Returns the TObject.ClassName
Specifies the media player control that plays the current media file.
Specifies the current playback position.
Specifies the total play time of the current media file.
Specifies the name of the current used media file.
Specifies whether the current media file is playing or is stopped.
Specifies the resolution of the current video file.
Specifies the audio volume of the current media file.
- ClassName¶
Returns the TObject.ClassName
- Control¶
Specifies the media player control that plays the current media file. Set Control to specify the media player control that plays the current media file.
Tip: For easy access to media files and easy playing, use the TMediaPlayer or TMediaPlayerControl visual components. Giving the name of the file to be played will automatically create the TMedia objects and set the Control to the current used media player control.
- Type:
- CurrentTime¶
Specifies the current playback position. CurrentTime is measured in 100ns. To obtain s, divide Duration by MediaTimeScale. Set CurrentTime to control the current position to be played.
- Type:
int
- Duration¶
Specifies the total play time of the current media file. Duration is measured in 100ns. To obtain s, divide Duration by MediaTimeScale.
- Type:
int
- FileName¶
Specifies the name of the current used media file. FileName specifies the name of the media file used to create the current TMedia object. FileName includes the path, name, and extension of the media file.
- Type:
str
- Free()¶
Frees the Wrapped Delphi Object
- InheritsFrom(ClassName)¶
Returns True if Delphi Object is or inherits from ClassName
- Play()¶
Starts the playback of the current media file. Call the Play method to playback the current media file. To pause or stop the current media file from playing, call the Stop method.
- SetProps(prop1=val1, prop2=val2...)¶
Sets several properties in one call
- State¶
Specifies whether the current media file is playing or is stopped. If the current media file is not assigned or supported, then State is set to Unavailable. If the current media file is playing, then State is set to Playing, otherwise it is set to Stopped.
- Type:
MediaState
- Stop()¶
Stops the playback of the current media file. Call the Stop method to stop or to pause the current played media file. To play the current media file, call the Play method.
- ToList()¶
If the object is a container (TStrings, TComponent…), it returns the content of the sequence as a Python list object.
- ToTuple()¶
If the object is a container (TStrings, TComponent…), it returns the content of the sequence as a Python tuple object.
- VideoSize¶
Specifies the resolution of the current video file. VideoSize specifies the native width and height of the current media file, in pixels. VideoSize is a TPointF. The X coordinate of the point represents the width of the window, and the Y coordinate of the point represents the height of the window. If the media file is audio only and does not have a window to be displayed, VideoSize is (0,0).
- Type:
- Volume¶
Specifies the audio volume of the current media file. Volume takes values in the range from 0 through 1. If Volume is 1, then the media file is played at the maximum native volume. If Volume is 0, then the media file is mute.
- Type:
float