質問

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