Answered by:
How to get notified when MediaCapture stops capturing after the app is switched to the background

Question
-
It is fine if the behavior is by design though it is not ideal. How can an app get notified when the video capturing stops?
Hong
- Edited by Hong (MA, USA) Saturday, November 1, 2014 2:43 AM
Thursday, October 30, 2014 2:36 PM
Answers
-
Hello Hong,
VisibilityChanged should work too.
-James
Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Marked as answer by Hong (MA, USA) Monday, November 10, 2014 8:38 PM
Monday, November 10, 2014 6:58 PMModerator
All replies
-
That's going to happen because the app gets suspended. It's by design because apps should not be spying on the users without them knowing. I would handle the OnSuspend state and stop the recording at that point.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.Thursday, October 30, 2014 7:20 PMModerator -
Thanks for the tip, Matt.
That is what I thought. I have heard that it takes a few seconds for the suspension to happen. However, the capture stops immediately after the app is sent to the background. In other words, if I send the app to the background and bring it back in a fraction of second, the video capture stops. If I use debug mode which prevents suspension (Am I right?), the video capture stops and Current_Suspending is never called.
Hong
Thursday, October 30, 2014 7:34 PM -
Hello Hong,
The audio stops playing or recording when the app looses focus as well as when it gets suspended. This is by design. Try handling the Page.LostFocus event.
I hope this helps,
James
Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
Friday, November 7, 2014 1:01 AMModerator -
Thanks a lot for the clarification.
I recently added a handler of Window.Current.VisibilityChanged to manage this. Could you let me know if it is equivalent to Page.LostFocus event or the later has some advantages.
Hong
Friday, November 7, 2014 1:12 AM -
Hello Hong,
VisibilityChanged should work too.
-James
Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Marked as answer by Hong (MA, USA) Monday, November 10, 2014 8:38 PM
Monday, November 10, 2014 6:58 PMModerator