locked
MediaCapture - pausing/resuming capture

    Question

  • I'm using the MediaCapture class to capture audio from a microphone and have run into a bit of a quandry - I want to pause and then resume capturing so the two recordings seperated by that pause from the user are contiguous on the same stream. Using MediaCapture.StartRecordToStreamAsync(MediaEncodingProfile, IRandomAccessStream) and MediaCapture.StopRecordAsync() get the recording to start and stop fine, but after stopping, when I try and pass the same stream to StartRecordToStreamAsync() to continue recording after the already existing audio it always overwrites the original audio with the second session of recording.

    Is there a way to do this? It seems simple enough, I just can't seem to get around what seems to be some default behavior here. Does StartRecordToStreamAsync() by design always start from position 0 in the stream?

    Thanks!

    PS (I've tried manually setting the position via IRandomAccessStream->Seek(Position_I_Paused_At) but even doing that doesn't seem to get the MediaCapture to continue recording form that point)

    Friday, June 22, 2012 10:37 PM

Answers

  • Hi Amkent,

    There isn't a good way to do this with the MediaCapture element. You would need to make multiple recordings and play them in sequence or splice them together afterwards.

    Since you need more control than the MediaCapture element provides you can use WASAPI. WASAPI will let you capture the uncompressed audio and ignore the bits that you don't want.

    --Rob

    • Proposed as answer by Jesse Jiang Monday, June 25, 2012 4:42 AM
    • Marked as answer by amkent Monday, June 25, 2012 3:37 PM
    Friday, June 22, 2012 11:42 PM
    Owner

All replies

  • Hi Amkent,

    There isn't a good way to do this with the MediaCapture element. You would need to make multiple recordings and play them in sequence or splice them together afterwards.

    Since you need more control than the MediaCapture element provides you can use WASAPI. WASAPI will let you capture the uncompressed audio and ignore the bits that you don't want.

    --Rob

    • Proposed as answer by Jesse Jiang Monday, June 25, 2012 4:42 AM
    • Marked as answer by amkent Monday, June 25, 2012 3:37 PM
    Friday, June 22, 2012 11:42 PM
    Owner
  • Thank you - this looks like it will work for all my audio needs (pause/resume and metro support). Is there an alternative to MediaCapture with these capabilities you would recommend for video support?
    Monday, June 25, 2012 6:33 PM