cordova - How to get navigator.getUserMedia working using PhoneGap -


i show camera live video using phonegap application. have created code base on example - http://www.html5rocks.com/en/tutorials/getusermedia/intro/.

i created html object

<video autoplay></video> 

and created code:

var errorcallback = function(e) {    console.log('reeeejected!', e); };  navigator.getusermedia  = navigator.getusermedia ||                       navigator.webkitgetusermedia ||                       navigator.mozgetusermedia ||                       navigator.msgetusermedia;  var video = document.queryselector('video');  if (navigator.getusermedia) {     navigator.getusermedia({audio: true, video: true}, function(stream) {         video.src = window.url.createobjecturl(stream);     }, errorcallback); } else {     cosnole.log("no media available"); } 

the application throws no exception, video object created, can hear audio, video presented black region - no live stream displayed. knows, what's wrong?

i have been playing plugins while. once added cordova-plugin-camera-preview , cordova-plugin-compat, phone asked camera permission during installation process , able see camera preview. cordova-plugin-camera-preview adds andriod.permission.camera. unfortunately, video black again when permission added manually without plugin.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -