提交 3b5322af 编写于 作者: R rafael-rosa-knowcode 提交者: Jerome Laban

chore: mute

上级 1c812bdb
...@@ -125,7 +125,14 @@ public partial class GTKMediaPlayer : Border ...@@ -125,7 +125,14 @@ public partial class GTKMediaPlayer : Border
_videoView.Visible = true; _videoView.Visible = true;
} }
} }
public void Mute(bool IsMuted)
{
if (_videoView != null && _mediaPlayer != null)
{
Console.WriteLine($"Mute {IsMuted}");
_mediaPlayer.Mute = IsMuted;
}
}
public string Source public string Source
{ {
get => (string)GetValue(SourceProperty); get => (string)GetValue(SourceProperty);
......
...@@ -388,19 +388,12 @@ public partial class MediaPlayerExtension : IMediaPlayerExtension ...@@ -388,19 +388,12 @@ public partial class MediaPlayerExtension : IMediaPlayerExtension
public void SetSurfaceSize(Size size) => throw new NotImplementedException(); public void SetSurfaceSize(Size size) => throw new NotImplementedException();
public void ToggleMute() public void ToggleMute()
{ {
if (_owner.IsMuted) if (_player is not null)
{
_player?.SetVolume(0);
}
else
{ {
var volume = (int)(_owner.Volume / 100); _player?.Mute(_owner.IsMuted);
_player?.SetVolume(volume);
} }
} }
public void OnOptionChanged(string name, object value) => throw new NotImplementedException(); public void OnOptionChanged(string name, object value) => throw new NotImplementedException();
public void Dispose() public void Dispose()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册