locked
play click sound RRS feed

  • Question

  • hi

    I would like to play the sound click when a button is pressed.

    i used the following (VB) :

      MediaElement1.Source = New Uri(Me.BaseUri, "Assets/click.wav")

    but the problem is there is a delay between pressing the button and hearing the sound in my surface rt.

     


    • Edited by imr2k1 Sunday, March 17, 2013 9:11 AM
    Sunday, March 17, 2013 9:10 AM

Answers

  • It seems like you're reloading the file every time you press the button.  Load it once and then use MediaElement1.Play();


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by imr2k1 Wednesday, March 20, 2013 1:17 PM
    Monday, March 18, 2013 1:57 PM
    Moderator

All replies

  • It seems like you're reloading the file every time you press the button.  Load it once and then use MediaElement1.Play();


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by imr2k1 Wednesday, March 20, 2013 1:17 PM
    Monday, March 18, 2013 1:57 PM
    Moderator
  • thanks , it work great

    Wednesday, March 20, 2013 1:16 PM