我对WP开发很新......
使用以下代码播放音频
<MediaElement x:Name="MediaSound" HorizontalAlignment="Left" Height="100" Margin="76,60,0,0" VerticalAlignment="Top" Width="100" Visibility="Collapsed" Source="/sounds/build.wav" />
我需要动态更改媒体元素的来源。让我们假设我有10个音频文件,我想一个接一个地播放...
为此我想知道音频何时停止。是否有任何监听器可用,如在Android OnCompletionListener ...
我想要这样的事情......
private void genarateSound(){
MediaSound.Source = new Uri(audioPath[counter], UriKind.Relative);
MediaSound.Play();
//Just to say
MediaSound.Oncomplete+ = new OnComplete(AudioPlayComplete); //listen to audio Complete *Somthing like this*
}
//Code segment to execute when audio is stopped
AudioPlayComplete
{
counter++;
genarateSound();
}
任何帮助都很受欢迎.. TIA。