windows phone 8 - Soundeffect not playing in background -


i have application allows user take photos , save isolated storage upload server. trying play shutter sound when user clicks software capture button provided. documentation can find indicates soundeffect.play asynchronous sound should keep playing in background while logic continues, in case sound either partially plays or not have time play unless put breakpoint after play() or add thread.sleep(x) after call play().

private void btncaptureclick(object sender, routedeventargs e) {     if (_photocamera != null)     {     playshutter();      _filename = guid.newguid().tostring(); //a breakpoint here allow sound play     _photocamera.captureimage();     } }  private void playshutter() {     var info = app.getresourcestream(new uri("assets/camera.wav", urikind.relative));      try     {     _effect = soundeffect.fromstream((info.stream));     frameworkdispatcher.update();      using (_effect)     {         if (_effect.play())         {     //thread.sleep(1000); //uncommenting allow sound play if duration < 1000         }     }     }     catch (exception ex)     {     messagebox.show(ex.message);     } } 
  • i have tried using soundeffectinstance explicitly, behaviour not change.
  • i have tried explicitly calling play() asynchronously, no change in behaviour.
  • i have tried calling following code asynchronously, no change in behaviour.
  • i have tried calling frameworkdispatcher.update frequently, no change in behaviour.
  • i have tried setting .wav file in project “resource” causes nullreferenceexception when call _effect = soundeffect.fromstream((info.stream)); because info null.(even absolute path)

this behaviour present using both emulator , actual device via usb connection pc debug.

can me resolve frustrating issue please?

answering own issue now, using block causing behaviour, instance being disposed. no idea why using that!


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -