我有 2 个按钮,播放和暂停,当我点击暂停时,音乐停止,当我点击播放时,它从头开始播放音频。我想这样做,就像我按下 Play 时一样,它从我停止的地方恢复。
private void PlayAudio()
{
McMediaElement.LoadedBehavior = MediaState.Manual;
McMediaElement.Source = new Uri("../../SingAlong/Food Fit For A King/old king cole.mp3", UriKind.RelativeOrAbsolute);
McMediaElement.Play();
}
private void button1_Click_1(object sender, RoutedEventArgs e)
{
PlayAudio();
}
private void button2_Click(object sender, RoutedEventArgs e)
{
McMediaElement.Pause();
}