문제

I'm trying to stop my webcam preview when my app suspends (because it doesn't like resuming).

I'm following the 'Getting Started' guide on MSDN here

I've added await mediaCaptureMgr.StopPreviewAsync(); to the SaveState async method (that's used in example apps). This works perfectly using Visual Studio's 'Suspend' option (in the Debug Location toolbar) but SaveState doesn't fire when the app is suspended legitimately by switching apps in Windows itself.

I've tested this with the default grid project and the same thing happens (fires when 'Suspending' with VS but not by switching away from it)

Am I supposed to be doing this a different way?

Cheers,

Nick

도움이 되었습니까?

해결책

App suspension does not occur immediately after an app is no longer visible. There is a delay of about 10 seconds before an app is suspended. This (and more detailed) information can be found in this Application lifecycle article.

Also, Task Manager provides a convenient way to view if an app has been suspended. By default, the suspended status is not visible, but can be enabled as shown below.

How to show suspended status in Task Manager

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top