javascript - Windows 8 how to choose which camera to initialize -


i developing windows store app , using camera , microphone capabilities. camera initialized examples have found initialize front camera. here's code have:

windows.devices.enumeration.deviceinformation.findallasync(windows.devices.enumeration.deviceclass.videocapture)     .done(function (devices) {         if (devices.length > 0) {             // using windows.media.capture.mediacapture apis stream webcam              mediacapturemgr = new windows.media.capture.mediacapture();             mediacapturemgr.initializeasync().done(initializecomplete, initializeerror);         } else {             var div = document.createelement('div');             div.innerhtml = "no camera found";             document.body.appendchild(div);         }     }); 

in case mediacapturemgr refers front camera. went through documentation , says have provide videodeviceid mediacapture() function this:

mediacapturemgr = new windows.media.capture.mediacapture({     videodeviceid: devices[1].id }); 

however still front camera initialized. writing , testing on surface. me this?

you have create mediacaptureinitializationsettings object:

var settings = new windows.media.capture.mediacaptureinitializationsettings(); settings.videodeviceid = devices[1].id; mediacapturemgr.initializeasync(settings).done(initializecomplete, initializeerror); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -