easy-js-camera
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "easy-js-camera", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A package which helps with adding camera support to a web application", | ||
@@ -5,0 +5,0 @@ "main": "lib/Camera.js", |
@@ -49,2 +49,11 @@ # Intro | ||
* **stop:** This method is responsible for stoping the stream. | ||
* **switch:** This method switches the camera between `front` and `rear`. This method returns a promise. It is better that you disable the switch camera button while it is doing its job because on some phones with `motorized` selfie camera if the user press the button multiple times the camera will hang and will just stickout and no longer works unless he/she restarts the phone. | ||
* **switch:** This method switches the camera between `front` and `rear`. This method returns a promise. It is better that you disable the switch camera button while it is doing its job because on some phones with `motorized` selfie camera if the user press the button multiple times the camera will hang and will just stickout and no longer works unless he/she restarts the phone. Please **Note** that this method accept a boolean which is called `tryAgain` and it basically tries to access the rear camera. Sometime the rear camera is not accessible and on catch you can do something like below | ||
``` | ||
function switchCamera(tryAgain = false) { | ||
this.camera.switch(tryAgain) | ||
.catch(() => { | ||
if(tryAgain) return; // This line prevent loops. Because the tryAgain may also fail | ||
this.camera.switch(true); | ||
}); | ||
} | ||
``` |
14820
58