I'm using Webcam.min.js library to capture image. When i'm using Tablet horizontally then it's working properly. But when i'm doing Tablet vertically then camera not rotating.
My code is:
<script type="text/javascript" src="../assets/webcam.min.js"></script>
<h4>Take picture</h4>
<div style="float:left;">
<div id="my_camera"></div>
<input type="button" id="snap" value="Take Snapshot" ng-click="ctrl.take_snapshot()">
</div>
<div style="display: inline-block;margin-top: -35px;;margin-left: 30%;;" id="results">Your captured image will appear here...</div>
Script code:
Webcam.set({
width: 320,
height: 240,
image_format: 'jpeg',
jpeg_quality: 90,
flip_horiz: true,
constraints: {
video: true,
facingMode: "environment"
}
});
Webcam.attach( '#my_camera' );
this.take_snapshot= function take_snapshot() {
// take snapshot and get image data
Webcam.snap( function(data_uri) {
// display results in page
document.getElementById('results').innerHTML =
'<h5>Captured on : '+new Date()+'</h5>' +
'<img src="'+data_uri+'"/>';
alert(data_uri);
} );
}
I struggle a lot to fix it. But no luck.