当App进入后台时,MediaElement不会触发任何事件 [英] MediaElement doesn't fire any event when App goes in Background

查看:91
本文介绍了当App进入后台时,MediaElement不会触发任何事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用MediaElement(Windows Phone 8.1)作为视频播放器但是,当我的应用程序进入后台时,它仍在运行而不是解雇任何事件。


我想暂停并再次恢复。当应用程序恢复时。



谢谢和问候,


Vikash singh

解决方案

您好,


您需要处理Suspending事件。你必须注册事件Application.Current.Suspending,当它被解雇时你必须在你的代码中停止播放。


你也可以订阅Application.Current.Resuming事件来开始播放再次在你的代码中。


看一下
如何暂停应用(XAML)
&n a;和
如何恢复应用(XAML)
 和
应用程序暂停和恢复指南


希望有所帮助



Hi,

I am using MediaElement (Windows phone 8.1) to  as video player but, When my app goes in background it still running and doesn't fire any event.

I want to pause it and resume it again. when app resumes.

Thanks and Regards,

Vikash singh

解决方案

Hi,

you need to handle Suspending event. You have to register the event Application.Current.Suspending and when it is fired you have to stop the playback in your code.

Also you can subscribe Application.Current.Resuming event to start playback again in your code.

Take a look at How to suspend an app (XAML) and How to resume an app (XAML) and Guidelines for app suspend and resume.

Hope it helps


这篇关于当App进入后台时,MediaElement不会触发任何事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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