MediaView: Add Volume and Muted properties.
[GB.MEDIA.FORM] * NEW: MediaView: Volume is a new property to return or set the audio volume. * NEW: MediaView: Muted is a new property that defines if the audio is muted or not.
This commit is contained in:
parent
2b831182ac
commit
dc0ad72612
@ -1,5 +1,5 @@
|
||||
[Component]
|
||||
Key=gb.media.form
|
||||
Version=3.13.90
|
||||
Version=3.14.90
|
||||
Needs=Form
|
||||
Requires=gb.media
|
||||
|
@ -2,7 +2,7 @@
|
||||
Title=gb.media.form
|
||||
Startup=FTest
|
||||
Icon=.hidden/control/mediaview.png
|
||||
Version=3.13.90
|
||||
Version=3.14.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
Component=gb.gui
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
'Static Private $hLogo As Image
|
||||
|
||||
Property Volume As Float
|
||||
Property Muted As Boolean
|
||||
|
||||
Private $hPlayer As MediaPlayer
|
||||
Private $hImage As MediaControl
|
||||
|
||||
@ -289,6 +292,8 @@ Public Sub btnVolume_Click()
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
' Public Sub GetShowVideo() As Boolean
|
||||
'
|
||||
' Return Not $bNoVideo
|
||||
@ -449,3 +454,28 @@ Public Sub _new()
|
||||
Me.Proxy = dwgVideo
|
||||
|
||||
End
|
||||
|
||||
Private Function Volume_Read() As Float
|
||||
|
||||
Return $hPlayer.Audio.Volume
|
||||
|
||||
End
|
||||
|
||||
Private Sub Volume_Write(Value As Float)
|
||||
|
||||
Try sldVolume.Value = Value * 100
|
||||
|
||||
End
|
||||
|
||||
Private Function Muted_Read() As Boolean
|
||||
|
||||
Return sldVolume.Enabled
|
||||
|
||||
End
|
||||
|
||||
Private Sub Muted_Write(Value As Boolean)
|
||||
|
||||
If sldVolume.Enabled = Value Then Return
|
||||
btnVolume_Click
|
||||
|
||||
End
|
||||
|
@ -1 +1,14 @@
|
||||
' Gambas class file
|
||||
|
||||
Public Sub Button1_Click()
|
||||
|
||||
MediaView1.Volume = Rnd
|
||||
|
||||
End
|
||||
|
||||
Static Public Sub _init()
|
||||
|
||||
Component.Load("gb.form")
|
||||
Application.Theme = "Gambas"
|
||||
|
||||
End
|
||||
|
@ -2,10 +2,19 @@
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,112,76)
|
||||
Arrangement = Arrange.Fill
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
Margin = True
|
||||
{ MediaView1 MediaView
|
||||
MoveScaled(4,5,38,30)
|
||||
Expand = True
|
||||
URL = "/home/benoit/Vidéos/vlc-record-2018-12-21.mp4"
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(4,39,78,4)
|
||||
{ Button1 Button
|
||||
MoveScaled(5,0,16,4)
|
||||
Text = ("Volume")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ Property Read Duration As Float '' Return the duration of the media in seconds
|
||||
Property Position As Float '' Return or set the current position inside the media in seconds.
|
||||
Property Speed As Float '' Return or set the playing speed of the media.
|
||||
|
||||
Property Volume As Float '' Return or set the volume of the audio track, between 0 and 1.
|
||||
Property Muted As Boolean '' Return or set if the audio is muted.
|
||||
|
||||
Private $hView As FMediaPlayer
|
||||
Private $sUrl As String
|
||||
Private $sNextUrl As String
|
||||
@ -153,3 +156,27 @@ Private Sub Speed_Write(Value As Float)
|
||||
$hView.SetSpeed(Value)
|
||||
|
||||
End
|
||||
|
||||
Private Function Volume_Read() As Float
|
||||
|
||||
Return $hView.Volume
|
||||
|
||||
End
|
||||
|
||||
Private Sub Volume_Write(Value As Float)
|
||||
|
||||
$hView.Volume = Value
|
||||
|
||||
End
|
||||
|
||||
Private Function Muted_Read() As Boolean
|
||||
|
||||
Return $hView.Muted
|
||||
|
||||
End
|
||||
|
||||
Private Sub Muted_Write(Value As Boolean)
|
||||
|
||||
$hView.Muted = Value
|
||||
|
||||
End
|
||||
|
Loading…
x
Reference in New Issue
Block a user