Media and msAudioCategory - soundlevelchanged event not firing? RRS feed

  • Question

  • Hello guys.

    After seeing the plat-776t session (http://channel9.msdn.com/Events/BUILD/BUILD2011/PLAT-776T), I'm under the impression that the platform will automatically handle the sound of the background media capable app. For instance, if the foreground app starts playing an alert, the background app should see its sound decreased automatically. I'm not seeing this happening. the only category of media which  will decrease the sound of the background media category is communications (ie, the background sound will only be decreased when the foreground app is reproducing audio with the msAudioCategory set to communications).

    Does that mean that I need to handle the soundlevelchanged event to reduce the sound/pause the sounds reproduced by the background media application?


    Luis Abreu

    Monday, May 14, 2012 11:50 AM


All replies

  • Luis,

    Yes –alerts should duck the audio automatically.  First thing to check is whether you have an “s” on the end of Alert(s).  There should be one.

    If this does not work, I will need your projects to attempt and repro the situation.


    Jeff Sanders (MSFT)

    Monday, May 14, 2012 5:25 PM
  • Yep, that's it! I was missing an s :)

    One more question: In order to test this, I've built 2 apps.

    the first reproduces all mp3 files placed inside a fodler picked by the user. This app will also handle the soundlevelchanged even in a really simple way: when it received the mute value, it pause the play. All other values will simply result in a play.

    the second app has four audio elements which are associated with differente categories:

    1. has no category

    2. foreground only media

    3. alerts

    4. communications

    I start app 1 and load several tracks on it. After that, I start app number 2. Here's what I'm seing:

    * when I pick audio 1, both apps reproduce the musics and nothing special happens. I'm assuming this is the expected behavior

    * playing audio 2 will pause app1's audio. I'm also assuming this is the expected behavior due to the way app1 handles the soundlevelchanged event

    * stopping audio 2 will simply stop the playing in app2. to get app1's audio back, I need to put it in the foregorund. is this the expected behavior? I expected to have it resume its music right after stopping 2, but I can live with this behavior

    * playing audio3 does indeed reduce the volume of app1's audio. When it stops, app1 resumes its previous audio volume.

    * playing audio 4 does produce the same result: while it's playing, app1's audio gets really low.

    Now, the problem:

    if I never  play audio4 (communications category), then I can repeat the behavior associated with audio2 whenever I wish. In other words, whenever I start audio2, it will pause app1's audio. I've tried in several times and it worked several times. After playing audio 4 (communications) for the 1st time, this no longer happens! I mean, after playing audio4 at least once, it seems like the soundlevelchanged messages which were generated by starting audio 2(foreground only media) are no longer generated. Is this a know problem? (or probably I've messed up again :))


    Luis Abreu

    Monday, May 14, 2012 9:10 PM
  • Hi Luis,

    The first section seem to me to be by design.  The different behavior after playing communications is not.

    Can you send me a repro set of projects for this to investigate further?


    Jeff Sanders (MSFT)

    Tuesday, May 15, 2012 12:59 PM
  • Yes, I can.


    Luis Abreu

    Tuesday, May 15, 2012 8:58 PM
  • Send me an initial email from here and we will connect!



    Jeff Sanders (MSFT)

    • Marked as answer by Dino He Tuesday, May 22, 2012 7:09 AM
    Wednesday, May 16, 2012 12:02 PM
  • done.

    Luis Abreu

    Wednesday, May 16, 2012 1:19 PM