c# - WPF Storyboard delay in playing wma files -


I am making a complete startup in WPF and an app that uses the storyboard to play sound.

  Public Zero PlaySound () {MediaElement m = (MediaElement) audio.FindName ("MySound.wma"); M.IsMuted = false; Framework element audio = (framework element) keys.Findname ("mess sand"); Storyboard S = (Storyboard) Audicike Fondersource ("Mass. Woma"); S.Begin (audioKey); } & Lt; Storyboard x: key = "MySound.wma" & gt; & Lt; MediaTimeline D: DesignTime Naturalization = "1.615" Start Time = "00:00:00" Storyboard TargetName = "MySound. Vauma" Source = "Audio \ MySound.Vomma" / & gt; & Lt; / Storyboard & gt;  

I have a terrible gaps and sometimes 10 seconds to play sound. I suspect that there is something like this with the fact that no matter how long I wait - the sound is not played until after leaving the function. I do not understand that I start call, and nothing happens. Is there a way to change this method, or something with the storyboard object that plays instantly and without intervals?

I changed my code -

  & lt; Button cursor = "hand" horizontal alignment = "left" margin = "70,0,0,0" x: name = "mybutton" width = "286" content = "hello!" Focusable = "False" IsTabStop = "False" & gt; & Lt; Button.Triggers & gt; & Lt; Event Trigger Routing Avent = "Button. PravumMusUftButtonDown" & gt; & Lt; EventTrigger.Actions & gt; & Lt; BeginStoryboard & gt; & Lt; Storyboard SlipBiHar = "slip" start time = "00:00:00" & gt; & Lt; MediaTimeline Storyboard TargetName = "MySound_wma" source = "MySound.wma" /> & Lt; / Storyboard & gt; & Lt; / BeginStoryboard & gt; & Lt; /EventTrigger.Actions> & Lt; / EventTrigger & gt; & Lt; /Button.Triggers> & Lt; / Button & gt;  

And it's working fine, thanks xD


Comments