我的Windows应用商店应用最小化后停止播放音频 [英] My Windows Store app stops playing audio when minimized

查看:119
本文介绍了我的Windows应用商店应用最小化后停止播放音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我有一个PWA /托管的网络应用
在Windows应用商店中发布
。它是一个音乐应用程序,它工作正常...除非我最小化应用程序。


当我最小化应用程序时,音频停止播放。我该如何解决这个问题?


我的第一个想法是,"哦,我需要在我的$中指定 backgroundMediaPlayback功能b $ b appxmanifest.xml "





做到了(在这里查看我的appxmanifest.xml) ,
但最小化时仍然无法播放音频。我的appxmanifest有以下内容:


< Capabilities>   
< Capability Name =" internetClient" />&NBSP;&NBSP;
< uap3:Capability Name =" backgroundMediaPlayback" />
< / Capabilities>

但这仍然不起作用。


我需要什么是否可以使我的Windows应用程序即使在最小化时也能播放音频?




解决方案


嗨Judah Gabriel Himango,



一般情况下,如果您启用了backgroundMediaPlayback功能,将能够在后台播放音频或视频。



我做了一个简单的测试:



 public MainPage()
{
this.InitializeComponent() ;
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.Source = MediaSource.CreateFromUri(new Uri(" ms-appx:///Assets/123444.mp3"));
mediaPlayer.Play();

}







我启用了该功能。当我最小化应用程序时,它仍在播放。



你能告诉我你的操作系统版本和目标版本吗?



如何播放音频,使用mediaplayer或MediaPlayerElement?





最好的问候



罗伊


Hi guys,

I have a PWA / hosted web app that is published in the Windows Store here. It's an music app, and it works fine...unless I minimize the app.

When I minimize the app, the audio stops playing. How can I fix this?

My first thought was, "Oh, I need to specify the backgroundMediaPlayback capability in my appxmanifest.xml"


I did that (view my appxmanifest.xml here), but it still doesn't play audio while minimized. My appxmanifest has the following:

<Capabilities>   
   <Capability Name="internetClient" />   
   <uap3:Capability Name="backgroundMediaPlayback" />
</Capabilities>

But this still doesn't work.

What do I need to do to make my Windows Store app be able to play audio even while minimized?


Judah Gabriel Himango

解决方案

Hi Judah Gabriel Himango,

In general, if you have enabled backgroundMediaPlayback capability, you will be able to play audio or video in background.

I made a simple test like this:

  public MainPage()
        {
            this.InitializeComponent();
            MediaPlayer mediaPlayer = new MediaPlayer();
            mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/123444.mp3"));
            mediaPlayer.Play();

        }


And I enabled the capability. When I minimize the app, it is still playing.

Could you please tell me your OS version and target version?

How you play the audio, using mediaplayer or MediaPlayerElement?

Best regards

Roy


这篇关于我的Windows应用商店应用最小化后停止播放音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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