locked
Capturing Video Feed without UI Prompt

    Question

  • Hi,

    Is there a way that I can capture video or photo from the device's camera (i.e. tablet webcam) without having to prompt the user to begin capturing?  I understand they will still have to give permissions for my application to use it, but I want to be able to capture stills/video without having to prompt the user to capture it.  This will be used in a 3D game that uses facial tracking to change the perspective of the camera in real time.

    The only example I had seen out there for C++ was the Camera Capture sample, but that uses UI.

    Thanks

    Wednesday, November 16, 2011 2:20 AM

Answers

  • Take a look at the MediaCapture class.  There is a JavaScript sample which should give the general idea of how to use it even if the details of the syntax are different.

    --Rob

    Wednesday, November 16, 2011 2:38 AM
    Owner

All replies

  • Take a look at the MediaCapture class.  There is a JavaScript sample which should give the general idea of how to use it even if the details of the syntax are different.

    --Rob

    Wednesday, November 16, 2011 2:38 AM
    Owner
  • Okay great got that up and running.  It seems to be recording the MP4 data to an InMemoryRandomAccessStream() I created.  The only problem is that I assume you can only get the data from InMemoryRandomAccessStream() by doing:

    random_access_stream_->GetOutputStreamAt(position);

    How do I decode this (knowing it is MP4)?  For example, if I wanted to just display the raw video on the screen (no audio), how would I calculate the RGB values of each pixel (you can leave out the stuff about drawing with DirectX which I can read up on later)?

    Thanks

    Thursday, November 17, 2011 9:15 PM
  • I have uploaded a sample here:

    http://code.msdn.microsoft.com/Media-Capture-Sample-in-CPP-d78ef2a9

    Thanks


    Raman Sharma | Program Manager, Visual C++ | @rasharm_msft

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Saturday, November 19, 2011 3:07 AM