Asked by:

How to use MediaCapture.SetEncoderProperty API

Question

I am following the SimpleCommunication provided here to develop a VOIP app (http://code.msdn.microsoft.com/windowsapps/Simple-Communication-Sample-eac73290)

I need to use API MediaCapture.GetEncoderProperty(MediaStreamType mediaStreamType, Guid propertyId) and SetEncoderProperty( MediaStreamType mediaStreamType, Guid propertyId, Object^ propertyValue) to access the encoder property like bit rate,
but I found that I got exception every time I tried to call it.

If I call GetEncoderProperty with mediaStreamType set to Audio or VideoRecord the Win RT exception would say "not implemented" and if I tried VideoPreview it would be "the requested attribute was not found", and on calling SetEncoderProperty
I would get "not implemented" or memory access violation

None of them works so I guess the issue must be the way I was using the API, I simply called it in the main thread of my app (actually it is in a button I added to SimpleCommunication app) and nothing special.

I did follow that link and used the GUID in the codec object doc of Windows mentioned in that thread, but the problem is that every time I tried to call setEncoderProperty or getEncoderProperty I got com exception and crash, the code I was using was like: