你好,
>>但这却不能正常工作,没有任何声音播放!
首先,我们查看下音频文件的Build Action,一般为Content:
其次,如果你把播放的后台代码放在页面的构造函数中,因为你的AutoPlay设置为False,所以App打开的时候是不会播放声音的,我们需要开启AutoPlay:
public MainPage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
m1.Source = new Uri("ms-appx:///Sounds/ring5.mp3");
m1.AutoPlay = true;//Here
m1.Play();
}
>>如果我的mp3在【Windows.Storage.ApplicationData.Current.LocalFolder】中,我又改如何指定路径才能播放?
如果你是直接放置在LocalFolder下的,可以这样设置:
m1.Source = new Uri("ms-appdata:///local/ring5.mp3");
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.