locked
MediaCapture.initializeAsync = Unknown runtime error RRS feed

  • Question

  • When I try to initialize MediaCapture, it fails with error "Unknown runtime error". Any clue what might be wrong?

    Things I have checked:

    1. Capabilities are set correctly in manifest

    2. Windows.Devices return audioCapture and audioRender devices

     


    Amit Kumar
    Tuesday, December 27, 2011 8:23 AM

Answers

  • Amit,

     

    I spoke with another developer today and he mentioned that there is a known issue with the "developer preview" that prevents the "MediaCapture" API from using the PCM codec. I'm not entirely sure that this is exactly what we are seeing but it is likely related. I am still investigating but at this time I think that we are going to find that audio only capture using the "MediaCapture" API will have to wait for the next release. I will do what I can to confirm this and get back to you next week.

     

    Thanks much,

    James

    Saturday, January 7, 2012 12:46 AM
    Moderator

All replies

  • Hi Amit,

    Have you tried one of the samples?  Do they work?

    -Jeff


    Jeff Sanders (MSFT)
    Tuesday, December 27, 2011 2:49 PM
    Moderator
  • Yes, I used one of the sample only, CameraOptionsUI to be precised.
    Amit Kumar
    Tuesday, December 27, 2011 6:31 PM
  • And did it work?
    Jeff Sanders (MSFT)
    Wednesday, December 28, 2011 2:35 PM
    Moderator
  • Ah, I wasn't clear. I used the sdk sample only but it did not work and got me the exception mentioned above.
    Amit Kumar
    Wednesday, December 28, 2011 6:00 PM
  • Hi Amit,

    If you do not have a camera, or the camera is not a supported camera you will get this error.

    To see if you have a supported camera, run the Camera Capture UI sample:

    http://code.msdn.microsoft.com/windowsapps/CameraCaptureUI-Sample-845a53ac

    -Jeff

     


    Jeff Sanders (MSFT)
    Wednesday, December 28, 2011 9:30 PM
    Moderator
  • I dont have camera, but I want to use just audio record/playback feature through microphone and speaker.

    I am hoping that I can still use audio features even if I dont have camera. MediaCapture.initializeAsync does not have any parameter so it should be able to initialize atleast for audio devices? 

     


    Amit Kumar
    Wednesday, December 28, 2011 10:01 PM
  •  Hello Amit,

    You should be able to use the “MediaCapture” API with audio only. Try using the “InitializeAsync” API that takes a “MediaCaptureInitializationSettings” object. Initalize the “MediaCaptureInitializationSettings” with an initialized “AudioDeviceId”. This should tell the “MediaCapture” object that you just want to use the specified audio device. I think that by using the default constructor the object tries to enumerate a video device by default but I’m not sure. If you aren’t able to get this working by specifying an “AudioDeviceId” let me know and I will do what I can to help.

    I hope this helps,

    James

    Windows Media SDK Technologies
    Microsoft Developer Services
    http://blogs.msdn.com/mediasdkstuff/

    Saturday, December 31, 2011 12:16 AM
    Moderator
  • No luck, this time I get  "Unspecified Error". Here is what i have:

        function initCaptureSettings() {

            captureInitSettings = null;

            captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();

            captureInitSettings.audioDeviceId = "";

            captureInitSettings.videoDeviceId = "";

            captureInitSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio;

            captureInitSettings.photoCaptureSource = Windows.Media.Capture.PhotoCaptureSource.auto;

            captureInitSettings.deviceExtensionEnabled = false;

            captureInitSettings.hardwareAccelerationEnabled = false;

            if (deviceList.length > 0) {

                captureInitSettings.audioDeviceId = deviceList[0].id;

            }

        }

        function enumerateDevices() {
            var deviceInfo = Windows.Devices.Enumeration.DeviceInformation;
            deviceInfo.findAllAsync(Windows.Devices.Enumeration.DeviceClass.audioCapture).then(function (devices) {
                // Add the devices to deviceList
                if (devices.length > 0) {
                    for (var i = 0; i < devices.length; i++) {
                        deviceList.push(devices[i]);
                    }
                    // Init media capture.
                    initCaptureSettings();
                    initializeMediaCapture();
                } else {
                    sdkSample.displayError("No camera device is found ");
                    // disable buttons.
                }
            }, function (err) {
            });
        }


    Amit Kumar
    Saturday, December 31, 2011 5:48 AM
  • Hey Amit,

    Okay, let me take a closer look at this. I will try to reproduce the problem and get back to you in a day or so with what I find out.

    Thanks for your patience,

    James

    Thursday, January 5, 2012 12:30 AM
    Moderator
  • Amit,

     

    I spoke with another developer today and he mentioned that there is a known issue with the "developer preview" that prevents the "MediaCapture" API from using the PCM codec. I'm not entirely sure that this is exactly what we are seeing but it is likely related. I am still investigating but at this time I think that we are going to find that audio only capture using the "MediaCapture" API will have to wait for the next release. I will do what I can to confirm this and get back to you next week.

     

    Thanks much,

    James

    Saturday, January 7, 2012 12:46 AM
    Moderator