The class implements a fully functional media player. The MediaPlayer class inherits MediaPipeline. This makes MediaPipeline the base class for the MediaPlayer control. Note that the class also has all the inherited properties, methods and events specified in the documentation! The class works like a read/write array and can be created.
How to create a new MediaPlayer:
Dim hMediaPlayer As MediaPlayer hMediaPlayer=New MediaPlayer ([Parent As MediaContainer,Type As String,Polling As Integer])[As "EventName"]
Notes on the three optional parameters:
The MediaPlayer class has these specific properties:
Property | Data type | Description |
---|---|---|
Audio | .MediaPlayer.Audio | Delivers a virtual object that is used to manage the audio part of the MediaPlayer. |
Balance | .MediaPlayer.Balance | Returns a virtual object that allows you to manipulate the video balances (Channel0: Contrast, Channel1: Brightness, Channel2: Hue and Channel3: Saturation). |
Buffering | Boolean | Returns or specifies whether buffering is activated. |
ConnectionSpeed | Long | Returns or sets the speed of the network connection in kbit/s. |
Input | MediaControl | Return or setting of the source of type MediaControl. |
NextURL | String | Returns or sets the URL of the next media to be played after the current one. If the property is NULL, the MediaPlayer stops at the end of the currently playing media. This property enables a smooth chaining of media playbacks. |
ProgressiveDownload | Boolean | Returns or sets whether (progressive) download buffering is enabled. |
Subtitles | .MediaPlayer.Subtitles | Returns a virtual object that is used for managing subtitles. |
URL | String | Gets or sets the URI of the currently playing media stream. |
Video | .MediaPlayer.Video | Returns a virtual object that is used to manage the media player's video stream. |
Table 23.10.1.1 : Properties of the MediaPlayer class
The .MediaPlayer.Audio class has these properties:
Property | Data type | Description |
---|---|---|
Count | Integer | Returns the total number of available audio streams. |
Current | Integer | Returns or sets the currently playing audio stream. By default, the first audio stream with data is played. |
Enabled | Boolean | Specifies with fidelity that the rendering of the audio stream is enabled or specifies that the rendering of the audio stream is enabled. |
Mute | Boolean | This property makes it possible to mute the audio channel without changing the (set internal) volume. |
NativeOnly | Boolean | Returns or sets the value if only native audio formats are allowed. |
Offset | Float | Returns or sets the synchronisation offset in seconds between the audio and video stream. With positive values, the audio is in front of the video; with negative values, the audio is behind the video. |
Output | MediaControl | Returns the value or sets the MediaControl to be used as the output, where NULL means the default sink. |
SoftwareVolume | Boolean | Returns or sets the value if software volume must be used. |
Volume | Float | Returns or sets the volume of the current audio stream. |
Table 23.10.1.1.1 : Properties of the .MediaPlayer.Audio class
The .MediaPlayer.Balance class has these properties:
Property | Data type | Description |
---|---|---|
Count | Integer | Specifies how many balance channels can be configured. |
Hardware | Boolean | Indicates whether video balances (contrast, brightness, hue and saturation) are managed directly by the hardware. |
Table 23.10.1.2.1 : Properties of the .MediaPlayer.Balance class
The virtual object .MediaPlayer.Balance.Channel implements a video balance channel with the properties Min (default: -1000), Max (default: +1000), Name and Value. You can explore the names of the individual balance channels, for example, with the following source code section:
For i = 0 To MPlayer.Balance.Count - 1 Print "MPlayer-BalanceChannel: "; i, MPlayer.Balance[i].Name Next
Output in the IDE console:
MPlayer-BalanceChannel: 0 CONTRAST MPlayer-BalanceChannel: 1 BRIGHTNESS MPlayer-BalanceChannel: 2 HUE MPlayer-BalanceChannel: 3 SATURATION
The following assignment allows you to manipulate the video balance channel for the contrast, for example:
Private SliderBalanceContrast As New Slider MediaPlayer.Balance[0].Value = SliderBalanceContrast.Value
The virtual class .MediaPlayer.Subtitles enables the management of subtitles provided by a MediaPlayer. The .MediaPlayer.Subtitles class has these properties:
Property | Data type | Description |
---|---|---|
Charset | String | Returns or sets the encoding to be assumed if the entered subtitles are not in UTF-8 encoding. If set to NULL, the environment variable GST_SUBTITLE_ENCODING is checked for an encoding to be used. If this environment variable is not set either, ISO-8859-15 is assumed. |
Count | Integer | Returns the total number of available subtitle streams. |
Current | Integer | Returns or sets the subtitle stream currently playing. By default, the first subtitle stream is played with data. |
Enabled | Boolean | Returns or sets whether subtitle rendering is enabled. |
Output | MediaControl | Returns or sets the MediaControl to be used for the text output. If set to NULL, the default setting “subtitleoverlay” is used. |
URL | String | Returns or sets the current subtitle URI. |
Table 23.10.1.3.1 : Properties of the .MediaPlayer.Subtitles class
This virtual class enables the management of the MediaPlayer video stream. This class is virtual. This class cannot be created. The .MediaPlayer.Video class has these properties:
Property | Data type | Description |
---|---|---|
Count | Integer | Returns the total number of available video streams. |
Current | Integer | Returns or sets the currently playing video stream. By default, the first video stream with data is played. |
Deinterlace | Boolean | Returns the value or specifies whether the raw video is deinterlaced - provided the NativeOnly property is false. |
Enabled | Boolean | Returns the value or sets whether the video stream is rendered. |
Image | Image | Returns the current video image as an image (image data type). |
NativeOnly | Boolean | Returns or sets the value if only native video formats are permitted. |
Output | MediaControl | Returns or sets the video output control to be used. If set to NULL, the default output is used. |
Visualisation | MediaControl | Returns or sets the visualisation control to be used. |
Table 23.10.1.4.1 : Properties of the virtual class .MediaPlayer.Video
The MediaPlayer class has these relevant events:
Event | Description |
---|---|
AudioChanged ( ) | The event is triggered when the number or order of the audio streams has changed. |
SubtitlesChanged ( ) | The event is triggered when the number or order of the subtitle streams has changed. |
VideoChanged ( ) | This event is triggered when the number or order of the video streams has changed. |
Table 23.10.1.5.1 : Events of the MediaPlayer class