I have a volume slider in my WinRT app which I would like to sync with the system volume. Is there a way to do this? iOS allows developers to give this functionality.
The volume of playback can be controlled using the MediaElement.Volume property. I cannot find a specific supporting quote but my own observations indicate the volume is per MediaElement object like it is in SilverLight and there is no way to change the system volume in an app.
The volume of playback can be controlled using the MediaElement.Volume property as this property is a double value between 0 and 1.
You can use a slider to control the volume in this case you do:
private void slider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
if(mute)
{
MediaElement.IsMuted = false;
mute = false;
MediaElement.Volume = (slider.Value)/100;
}
else
{
MediaElement.Volume = (slider.Value) / 100;
}
}
The mute variable is of Boolean data-type that controls whether the sound is cut or not
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With