diff --git a/comp/src/gb.media.form/.component b/comp/src/gb.media.form/.component index 8bd1cc50d..2da3b0f56 100644 --- a/comp/src/gb.media.form/.component +++ b/comp/src/gb.media.form/.component @@ -1,5 +1,5 @@ [Component] Key=gb.media.form -Version=3.13.90 +Version=3.14.90 Needs=Form Requires=gb.media diff --git a/comp/src/gb.media.form/.project b/comp/src/gb.media.form/.project index 473b55c53..b3429a1dd 100644 --- a/comp/src/gb.media.form/.project +++ b/comp/src/gb.media.form/.project @@ -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 diff --git a/comp/src/gb.media.form/.src/FMediaPlayer.class b/comp/src/gb.media.form/.src/FMediaPlayer.class index f4761b63c..185fe7be6 100644 --- a/comp/src/gb.media.form/.src/FMediaPlayer.class +++ b/comp/src/gb.media.form/.src/FMediaPlayer.class @@ -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 diff --git a/comp/src/gb.media.form/.src/FTest.class b/comp/src/gb.media.form/.src/FTest.class index f5baf4d70..dc0129bc0 100644 --- a/comp/src/gb.media.form/.src/FTest.class +++ b/comp/src/gb.media.form/.src/FTest.class @@ -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 diff --git a/comp/src/gb.media.form/.src/FTest.form b/comp/src/gb.media.form/.src/FTest.form index e76c10553..25ad664af 100644 --- a/comp/src/gb.media.form/.src/FTest.form +++ b/comp/src/gb.media.form/.src/FTest.form @@ -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") + } + } } diff --git a/comp/src/gb.media.form/.src/MediaView.class b/comp/src/gb.media.form/.src/MediaView.class index 93f175d47..72cf3167e 100644 --- a/comp/src/gb.media.form/.src/MediaView.class +++ b/comp/src/gb.media.form/.src/MediaView.class @@ -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