我正在研究控制音量的不同方法,但似乎无法在我的 Windows Phone 7.1 应用程序中设置 MediaPlayer.Volume。基本上,调用
MediaPlayer.Volume = value;
没有效果,调用 MediaPlayer.IsMuted = TRUE 没有效果。
例子:
public MainPage()
{
InitializeComponent();
//Play a song from the collection
FrameworkDispatcher.Update();
MediaPlayer.Play(ml.Artists[0].Songs[0]);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
//Reduce volume to 0
FrameworkDispatcher.Update();
MediaPlayer.Volume = 0.0f;
//If I set a breakpoint here, MediaPlayer.Volume is 1.0
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//This also has no effect...
FrameworkDispatcher.Update();
MediaPlayer.IsMuted = !MediaPlayer.IsMuted;
}
有谁知道我误解了什么简单明显的事实?