Answered by:
MediaCapture.initializeAsync = Unknown runtime error

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 KumarTuesday, 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
- Marked as answer by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, January 17, 2012 11:55 PM
Saturday, January 7, 2012 12:46 AMModerator
All replies
-
Hi Amit,
Have you tried one of the samples? Do they work?
-Jeff
Jeff Sanders (MSFT)Tuesday, December 27, 2011 2:49 PMModerator -
Yes, I used one of the sample only, CameraOptionsUI to be precised.
Amit KumarTuesday, December 27, 2011 6:31 PM -
And did it work?
Jeff Sanders (MSFT)Wednesday, December 28, 2011 2:35 PMModerator -
Ah, I wasn't clear. I used the sdk sample only but it did not work and got me the exception mentioned above.
Amit KumarWednesday, 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 PMModerator -
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 KumarWednesday, 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/- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Saturday, December 31, 2011 12:16 AM
Saturday, December 31, 2011 12:16 AMModerator -
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 deviceListif (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 KumarSaturday, 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 AMModerator -
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
- Marked as answer by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, January 17, 2012 11:55 PM
Saturday, January 7, 2012 12:46 AMModerator