Socket
Socket
Sign inDemoInstall

easy-js-camera

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

14

lib/Camera.js

@@ -6,2 +6,3 @@ 'use strict';

});
exports.Constraints = undefined;

@@ -18,3 +19,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var Constraints = function () {
var Constraints = exports.Constraints = function () {
function Constraints() {

@@ -32,4 +33,10 @@ _classCallCheck(this, Constraints);

value: function switchFacingMode() {
var tryAgain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (this.video.facingMode === 'user') {
this.video.facingMode = 'environment';
} else if (tryAgain) {
this.video.facingMode = {
exact: 'environment'
};
} else {

@@ -114,3 +121,2 @@ this.video.facingMode = 'user';

await _this2.getDevices();
console.log('Constraints', _this2.constraints.getConstraint());
var stream = await navigator.mediaDevices.getUserMedia(_this2.constraints.getConstraint());

@@ -140,4 +146,6 @@ _this2.videoElement.srcObject = stream;

var tryAgain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return new Promise(async function (resolve, reject) {
_this3.constraints = _this3.constraints.switchFacingMode();
_this3.constraints = _this3.constraints.switchFacingMode(tryAgain);
_this3.stop();

@@ -144,0 +152,0 @@ try {

{
"name": "easy-js-camera",
"version": "1.1.0",
"version": "1.1.1",
"description": "A package which helps with adding camera support to a web application",

@@ -5,0 +5,0 @@ "main": "lib/Camera.js",

import CameraModel from "./CameraModel";
class Constraints {
export class Constraints {
constructor() {

@@ -10,5 +10,9 @@ this.video = {

}
switchFacingMode() {
switchFacingMode(tryAgain = false) {
if(this.video.facingMode === 'user') {
this.video.facingMode = 'environment';
} else if(tryAgain) {
this.video.facingMode = {
exact: 'environment'
}
} else {

@@ -74,3 +78,2 @@ this.video.facingMode = 'user';

await this.getDevices();
console.log('Constraints', this.constraints.getConstraint());
let stream = await navigator.mediaDevices.getUserMedia(this.constraints.getConstraint());

@@ -92,5 +95,5 @@ this.videoElement.srcObject = stream;

}
switch() {
switch(tryAgain = false) {
return new Promise(async (resolve, reject) => {
this.constraints = this.constraints.switchFacingMode();
this.constraints = this.constraints.switchFacingMode(tryAgain);
this.stop();

@@ -97,0 +100,0 @@ try {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc