Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:42:29+00:00 2026-06-17T21:42:29+00:00

In a Windows 8 app (C#) using the MediaCapture class ( Windows.Media.Capture ) to

  • 0

In a Windows 8 app (C#) using the MediaCapture class (Windows.Media.Capture) to show a webcam feed, I’m trying to restart the preview when the app has lost and then come back into focus (e.g. by clicking in the top left screen corner to another app, then clicking again to come back to my app).

How I’m trying to restart the preview right now is:

Application.Current.Resuming += (sender, o) => StartVideo(video);
Application.Current.Suspending += (sender, args) => StopVideo();

internal async void StartVideo(CaptureElement e)
{
    try
    {
        this.stream = new MediaCapture();
        await this.stream.InitializeAsync();
        e.Source = this.stream;
        await this.stream.StartPreviewAsync();
    }
    catch
    {
        new MessageDialog("Unable to start the video capture.").ShowAsync();
    }
}

internal async void StopVideo()
{
    try
    {
        await stream.StopPreviewAsync();
    }
    catch { }
}

But, the Resuming and Suspending events don’t seem to fire in the example I describe above. Is this not “suspending” an app? If so, what is it/what events should I be on the lookout for?

Alternatively, should I, instead of using a long-running “preview” to display the webcam, use one of the this.stream.StartRecord... methods?

EDIT: If I fire the events manually using Visual Studio’s Suspend/Resume button (on the Debug Location toolbar), the functionality works as desired (the video restarts when the app is resumed).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:42:30+00:00Added an answer on June 17, 2026 at 9:42 pm

    I see a few things wrong:

    • You should avoid async void; use async Task for all methods except event handlers.
    • For “command” events such as Suspending, use the deferral provided by args.SuspendingOperation.GetDeferral if you have an async event handler.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload my GAE app using the console in windows. I
I'm using PhoneGap to develop a Windows Phone 7 app. I'm trying to call
I'm trying to install my Windows Service app using Visual Studio 2008 Setup and
I'm trying to make a Metro app using VS11 on Windows 8 CP using
I'm developing metro app using Windows 8 release preview and C#(VS 2012) and I
I'm developing metro app using Windows 8 release preview and C#(VS 2012), I'm stuck
I'm developing a Cocoa app using XCode 4. One of the windows has a
I am trying to deploy a simple windows desktop app using a SQL Server
I'm developing metro app using Windows 8 release preview and C#(VS 2012),I'm using below
I try to create a very simple app using windows API. I've done some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.