windows 8 - Metro style app media capture exception -


i'm writing first metro-style app. days ago i've written code taking photos based on sample (here) , works. release of windows 8 release preview , visual studio 2012 release candidate, same snippet doesn't work. seems there problem access camera in package.appxmanifest i've checked webcam capability. the xaml :

<canvas x:name="previewcanvas1" width="320"  height="240" background='gray'> <image x:name="imageelement1"  width="320" height="240" visibility="collapsed"/> <captureelement x:name="previewelement1" width="320" height="240" /> </canvas> <stackpanel orientation="horizontal" margin="20" horizontalalignment="center">  <button width="120" x:name="btnstartpreview2" click="btnstartpreview_click" isenabled="true"  margin="0,0,10,0"  background="#ffc3c3c3">da webcam</button> <button width="120" x:name="btntakephoto2" click="btntakephoto_click" isenabled="false"  margin="0,0,10,0"  background="#ffc3c3c3">scatta</button> </stackpanel> 

and code behind:

mediacapture mediacapturemgr; async void btnstartpreview_click(object sender, routedeventargs e)         {             try             {                  mediacapturemgr = new windows.media.capture.mediacapture();                 await mediacapturemgr.initializeasync();                  previewelement1.source = mediacapturemgr;                  await mediacapturemgr.startpreviewasync();              }             catch (exception ex)             {                 throw new exception(ex.message);             }         } 

the exception is: "access denied. (exception hresult: 0x80070005 (e_accessdenied))" said, webcam capability checked!

i solved it. use webcam must indicate in package.appxmanifest application needs access webcam , microphone. strange true!


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -