Need clarification on using audio on button click, background audio, etc in Windows Phone

前提是你 提交于 2019-11-29 17:32:20
MyKuLLSKI

To answer one (or more) of you questions:

  1. You do not need to ask the user permission before playing audio
  2. All this means is if something is playing before your sound plays you must resume it
  3. No you should be using a sound effect if its a sound effect and a media element if its a media file. Sound effect are usually 5-10seconds and not continuous. BAckground music that loops is not a sound effect.
  4. In Silverlight for WP7 only one MediaPlay can be played at a time. I got around this by making my project a Windows Phone Silverlight an XNA application Refer to my previous post. The idea is that my XNA part plays the sound effects while my mediaelement plays the background audio.

It can be a little confusing sometimes. Here is how I understand it:

You don't ask permission when all these conditions are met:

  • The sound doesn't repeat
  • The sound is interactive (in response to something the user did, like click a button)
  • You don't stop the background music (which means not using a MediaElement)

You do ask permission when:

  • The sound repeats or is continuous
  • The sound is like background music
  • You use a MediaElement (Because it stops the background music)

A clarification on interactive sounds: in my opinion a sound to signify that the program's state has changed (such as a timer's alarm going off) is still somewhat interactive and wouldn't need permission. Unless of course you start playing a song that functions more as background music.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!