Skip to content

Instantly share code, notes, and snippets.

@IshamMohamed
Created February 27, 2014 15:24
Show Gist options
  • Save IshamMohamed/9252224 to your computer and use it in GitHub Desktop.
Save IshamMohamed/9252224 to your computer and use it in GitHub Desktop.
public MainPage()
{
InitializeComponent();
startBackgroundMusic();
}
private void startBackgroundMusic()
{
this.Dispatcher.BeginInvoke(() =>
{
StreamResourceInfo info = Application.GetResourceStream(
new Uri("Assets/background.wav", UriKind.Relative));
backgroundMusic = SoundEffect.FromStream(info.Stream);
SoundEffectInstance instance = backgroundMusic.CreateInstance();
instance.IsLooped = true;
instance.Play();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment