需要澄清在 Windows Phone 中使用按钮单击、背景音频等的音频 [英] Need clarification on using audio on button click, background audio, etc in Windows Phone

查看:30
本文介绍了需要澄清在 Windows Phone 中使用按钮单击、背景音频等的音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个 WP 7.1/7.5/Mango Silverlight 应用程序.

This is a WP 7.1/7.5/Mango Silverlight app.

我有一个要求,我需要在点击图片(3-4 张图片)时播放声音,并且在用户第一次导航到页面时播放音频.

I have a requirement where I need to play sounds on image click (3-4 images) and also an audio plays when user navigates to the page first time.

所以我使用此处提到的 MediaElement 实现了它:Windows Phone 7.1- 媒体元素未播放

So I implemented that using MediaElement as mentioned here: Windows Phone 7.1 - Media Element not playing

问题:现在我正在测试应用程序.我开始在手机上播放广播.然后启动了我的应用程序.收音机还在播放.现在,当我导航到页面 Load 上有音频的页面时,收音机停止了.

Issue: Now I was testing the app. I started playing radio on the phone. Then started my app. Radio was still playing. Now when I navigated to the page that has audion on page Load, radio stopped.

认证要求(6.5 - 非音乐..)非常混乱:http://msdn.microsoft.com/en-us/library/hh184838(v=vs.92).aspx

Certification Requirements (6.5 - Non Music..) is very confusing: http://msdn.microsoft.com/en-us/library/hh184838(v=vs.92).aspx

问题:

1:在这种情况下,我是否需要在播放音频之前征得用户许可(使用弹出窗口)?

1: Do I need to ask user permission in this case (using a pop-up) before playing my audio?

2:要求 6.5.3 表示无需为非交互式音频请求许可.那是什么?

2: Req 6.5.3 says no need to ask permission for non-interactive audio. What is that?

3:如果我必须询问用户并且如果用户选择否",即不停止他们的收音机(或其他音乐),那么我唯一允许播放音频的是使用 MediaElement 的 SoundEffect 安装.那么我在 MediaElement 上做错了吗?

3: If I have to ask the user and if user selects No i.e. not to stop thier radio(or other music), then the only was for me to still allow to play my audio is using SoundEffect insted of MediaElement. So am I doing wrong with MediaElement?

4:我还计划在我完成上述音频设置后,在未来向我的应用程序添加背景/氛围音乐.要求 6.5.4.说 - SoundEffect 类不得用于在应用程序中播放连续的背景音乐曲目.不,在这种情况下,我只剩下 MedieElement.这是我找到的声音样本(第二个):http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx#BKMK_Media 这是我唯一能做的方法吗?

4: I am also planning to add a background/ambience music to my app in future once I am done setting up above audios. Req 6.5.4. says - The SoundEffect class must not be used to play a continuous background music track in an application. No so in that case I am left with MedieElement only. Here's rhe Sound Sample(second one) I found: http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx#BKMK_Media Is this the only way I can do?

任何建议都非常感谢.

注意:按钮点击和页面加载音频文件是短片(最长 5 秒),例如你好吗?,你叫什么名字?这里非常有趣,等等.所以它们不是歌曲.

Note: The button click and page load audio files are short clips(max 5 secs) e.g. How are you?, What's your name? It's so much fun here, etc. So they are not songs.

推荐答案

回答一个(或多个)问题:

To answer one (or more) of you questions:

  1. 播放音频前无需征得用户许可
  2. 所有这一切意味着如果在您的声音播放之前正在播放某些内容,您必须继续播放
  3. 不,如果是声音效果,则应该使用声音效果,如果是媒体文件,则应该使用媒体元素.音效一般为5-10秒,不连续.循环播放的背景音乐不是音效.
  4. 在 WP7 的 Silverlight 中,一次只能播放一个 MediaPlay.我通过使我的项目成为一个 Windows Phone Silverlight 一个 XNA 应用程序来解决这个问题 参考我之前的帖子.这个想法是我的 XNA 部分播放声音效果,而我的 mediaelement 播放背景音频.
  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.

这篇关于需要澄清在 Windows Phone 中使用按钮单击、背景音频等的音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆