来自平板电脑的后台后,MediaElement无法正常工作。(在PC上工作) [英] MediaElement not working after coming from background in tablet.(working in PC)

查看:74
本文介绍了来自平板电脑的后台后,MediaElement无法正常工作。(在PC上工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我在项目中添加了一个媒体元素,如下所示



< MediaElement Name =" media" 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; AudioCategory = QUOT; BackgroundCapableMedia"自动播放="虚假"

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP;源= QUOT; /Sounds/bgmusic_v9.mp3"装载= QUOT; OnMediaLoaded" MediaEnded =" OnMediaEnded" />


我有两个按钮(静音和取消静音)。在点击时我添加了以下代码


For取消静音:


App.appVariables.GlobalAudioElement.AutoPlay = true;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; App.appVariables.GlobalAudioElement.Play();


静音:


  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; App.appVariables.GlobalAudioElement.Pause();


当应用程序进入后台(打开另一个应用程序)或启动启动器时,这在我的计算机中正常工作。但它在Windows 8 thinkpad(平板电脑)中不起作用。这里声音播放,但当应用程序进入背景,后来进入前景声音休息。启动了与启动器相同的
。因为来自thinkpad平板电脑的背景声音不起作用。这在计算机上工作正常。





infact Microsoft在提交中拒绝了该应用程序


4.3:在审核此应用时,检测到不合适的听不见的背景媒体流。"



任何人都可以帮助我吗?

解决方案

Hey Ajin Prasad,


看看这个样本,


http://code.msdn.microsoft.com/windowsapps/Background-Audio-in -WinRT-344bcf4d


Hi All,

I have added a mediaelement in my project as below

<MediaElement Name="media" 
              AudioCategory="BackgroundCapableMedia" AutoPlay="False"
              Source="/Sounds/bgmusic_v9.mp3" Loaded="OnMediaLoaded" MediaEnded="OnMediaEnded"/>

I have two buttons(mute and unmute) .in their click i added the following code

For Unmute:

App.appVariables.GlobalAudioElement.AutoPlay = true;
                App.appVariables.GlobalAudioElement.Play();

For Mute:

                App.appVariables.GlobalAudioElement.Pause();

This works fine in my Computer when the app goes background(another app is opened) or a launcher is launched. But it doesn't work in windows 8 thinkpad(tablet). here sound plays but when app goes background and later comes in foreground sound breaks. same with a launcher is launched. So sound is not working after coming from background in thinkpad tablet. this works fine in computer.


infact Microsoft rejected the app in submission

"4.3: During the review of this app, an inappropriate inaudible background media stream was detected."

can anyone help me in this?

解决方案

Hey Ajin Prasad,

Have a look at this sample,

http://code.msdn.microsoft.com/windowsapps/Background-Audio-in-WinRT-344bcf4d


这篇关于来自平板电脑的后台后,MediaElement无法正常工作。(在PC上工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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