User Tools

Site Tools


Sidebar

Multimedia

k23:k23.10:start

23.10 MediaPlayer (gb.media)

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:

  • Parent (type MediaContainer): Sets the parent element of the control.
  • Type (type String): Sets the type of the MediaControl used.
  • Polling (type Integer): Sets the polling frequency of the message bus.

23.10.1 Properties

The MediaPlayer class has these specific properties:

PropertyData typeDescription
Audio.MediaPlayer.AudioDelivers a virtual object that is used to manage the audio part of the MediaPlayer.
Balance.MediaPlayer.BalanceReturns a virtual object that allows you to manipulate the video balances (Channel0: Contrast, Channel1: Brightness, Channel2: Hue and Channel3: Saturation).
BufferingBooleanReturns or specifies whether buffering is activated.
ConnectionSpeedLongReturns or sets the speed of the network connection in kbit/s.
InputMediaControlReturn or setting of the source of type MediaControl.
NextURLStringReturns 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.
ProgressiveDownloadBooleanReturns or sets whether (progressive) download buffering is enabled.
Subtitles .MediaPlayer.SubtitlesReturns a virtual object that is used for managing subtitles.
URLStringGets or sets the URI of the currently playing media stream.
Video .MediaPlayer.VideoReturns a virtual object that is used to manage the media player's video stream.

Table 23.10.1.1 : Properties of the MediaPlayer class

23.10.1.1 Properties of the virtual class .MediaPlayer.Audio

The .MediaPlayer.Audio class has these properties:

PropertyData typeDescription
CountIntegerReturns the total number of available audio streams.
CurrentIntegerReturns or sets the currently playing audio stream. By default, the first audio stream with data is played.
EnabledBooleanSpecifies with fidelity that the rendering of the audio stream is enabled or specifies that the rendering of the audio stream is enabled.
MuteBooleanThis property makes it possible to mute the audio channel without changing the (set internal) volume.
NativeOnlyBooleanReturns or sets the value if only native audio formats are allowed.
OffsetFloatReturns 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.
OutputMediaControlReturns the value or sets the MediaControl to be used as the output, where NULL means the default sink.
SoftwareVolumeBooleanReturns or sets the value if software volume must be used.
VolumeFloatReturns or sets the volume of the current audio stream.

Table 23.10.1.1.1 : Properties of the .MediaPlayer.Audio class

23.10.1.2 Properties of the virtual class .MediaPlayer.Balance

The .MediaPlayer.Balance class has these properties:

PropertyData typeDescription
CountIntegerSpecifies how many balance channels can be configured.
HardwareBooleanIndicates 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

23.10.1.3 Properties of the virtual class .MediaPlayer.Subtitles

The virtual class .MediaPlayer.Subtitles enables the management of subtitles provided by a MediaPlayer. The .MediaPlayer.Subtitles class has these properties:

PropertyData typeDescription
CharsetStringReturns 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.
CountIntegerReturns the total number of available subtitle streams.
CurrentIntegerReturns or sets the subtitle stream currently playing. By default, the first subtitle stream is played with data.
EnabledBooleanReturns or sets whether subtitle rendering is enabled.
OutputMediaControlReturns or sets the MediaControl to be used for the text output. If set to NULL, the default setting “subtitleoverlay” is used.
URLStringReturns or sets the current subtitle URI.

Table 23.10.1.3.1 : Properties of the .MediaPlayer.Subtitles class

23.10.1.4 Properties of the virtual class .MediaPlayer.Video

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:

PropertyData typeDescription
CountIntegerReturns the total number of available video streams.
CurrentIntegerReturns or sets the currently playing video stream. By default, the first video stream with data is played.
DeinterlaceBooleanReturns the value or specifies whether the raw video is deinterlaced - provided the NativeOnly property is false.
EnabledBooleanReturns the value or sets whether the video stream is rendered.
ImageImageReturns the current video image as an image (image data type).
NativeOnlyBooleanReturns or sets the value if only native video formats are permitted.
OutputMediaControlReturns or sets the video output control to be used. If set to NULL, the default output is used.
Visualisation MediaControlReturns or sets the visualisation control to be used.

Table 23.10.1.4.1 : Properties of the virtual class .MediaPlayer.Video

23.10.1.5 Events

The MediaPlayer class has these relevant events:

EventDescription
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

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k23/k23.10/start.txt · Last modified: 19.06.2024 by honsek

Page Tools