{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///jslib-html5-camera-photo.min.js","webpack:///webpack/bootstrap b2cad8ce99ae01b067a8","webpack:///./src/lib/MediaServices/constants.js","webpack:///./src/lib/index.js","webpack:///./src/lib/MediaServices/index.js","webpack:///./src/lib/MediaServices/helper.js","webpack:///./src/lib/constants.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","_defineProperty","obj","key","value","writable","SUPPORTED_FACING_MODES","FACING_MODES","SUPPORTED_IMAGE_TYPES","IMAGE_TYPES","FORMAT_TYPES","MINIMUM_CONSTRAINTS","_FORMAT_TYPES","USER","ENVIRONMENT","PNG","JPG","audio","video","_classCallCheck","instance","Constructor","TypeError","__WEBPACK_IMPORTED_MODULE_0__MediaServices__","__WEBPACK_IMPORTED_MODULE_1__constants__","_createClass","defineProperties","target","props","length","descriptor","protoProps","staticProps","DEFAULT_IMAGE_TYPE","MediaServices","CameraPhoto","videoElement","stream","numberOfMaxResolutionTry","settings","windowURL","getWindowURL","mediaDevices","getNavigatorMediaDevices","idealFacingMode","idealResolution","_this","Promise","resolve","reject","constraints","getIdealConstraints","getUserMedia","then","_gotStream","catch","error","_this2","getMaxResolutionConstraints","_getStreamDevice","constraint","message","console","setTimeout","_getStreamDeviceMaxResolution","srcObject","videoSrc","createObjectURL","src","getTracks","getSettings","_setSettings","_setVideoSrc","_this3","stopCamera","_this4","arguments","undefined","userConfig","config","sizeFactor","DEFAULT_SIZE_FACTOR","imageType","imageCompression","DEFAULT_IMAGE_COMPRESSION","isImageMirror","DEFAULT_IMAGE_MIRROR","getDataUri","_this5","forEach","track","stop","Error","__WEBPACK_IMPORTED_MODULE_0__helper__","videoWidth","videoHeight","_getImageSize","getImageSize","imageWidth","imageHeight","canvas","document","createElement","width","height","context","getContext","setTransform","drawImage","window","URL","webkitURL","mozURL","msURL","NMDevice","isNewAPI","navigator","isOldAPI","mozGetUserMedia","webkitGetUserMedia","NMDeviceOld","polyfillGetUserMedia","assign","getSupportedConstraints","facingMode","idealConstraints","isMinimumConstraints","supports","includes","VIDEO_ADVANCED_CONSTRANTS","min","advanced","slice","_validateImgParam","join","_getValidImgParam","imgParam","e","parseFloat","toDataURL","_isEmptyObject","_typeof","__WEBPACK_IMPORTED_MODULE_0__constants__","Symbol","iterator","constructor"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,2BAAAH,GACA,gBAAAC,SACAA,QAAA,sBAAAD,IAEAD,EAAA,sBAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAtB,GACA,GAAAe,GAAAf,KAAAuB,WACA,WAA2B,MAAAvB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAK,GAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDpB,EAAAuB,EAAA,GAGAvB,IAAAwB,EAAA,KDgBM,SAAU7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","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"JslibHtml5CameraPhoto\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"JslibHtml5CameraPhoto\"] = factory();\n\telse\n\t\troot[\"JslibHtml5CameraPhoto\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"JslibHtml5CameraPhoto\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"JslibHtml5CameraPhoto\"] = factory();\n\telse\n\t\troot[\"JslibHtml5CameraPhoto\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return SUPPORTED_FACING_MODES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return FACING_MODES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return SUPPORTED_IMAGE_TYPES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return IMAGE_TYPES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return FORMAT_TYPES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return MINIMUM_CONSTRAINTS; });\nvar _FORMAT_TYPES;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// camera constants\nvar USER = 'user';\nvar ENVIRONMENT = 'environment';\n\nvar SUPPORTED_FACING_MODES = [USER, ENVIRONMENT];\n\nvar FACING_MODES = {\n 'USER': USER,\n 'ENVIRONMENT': ENVIRONMENT\n};\n\n// Image constants\nvar PNG = 'png';\nvar JPG = 'jpg';\n\nvar SUPPORTED_IMAGE_TYPES = [JPG, PNG];\n\nvar IMAGE_TYPES = {\n 'PNG': PNG,\n 'JPG': JPG\n};\n\nvar FORMAT_TYPES = (_FORMAT_TYPES = {}, _defineProperty(_FORMAT_TYPES, JPG, 'image/jpeg'), _defineProperty(_FORMAT_TYPES, PNG, 'image/png'), _FORMAT_TYPES);\n\nvar MINIMUM_CONSTRAINTS = {\n audio: false,\n video: true\n};\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FACING_MODES\", function() { return FACING_MODES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IMAGE_TYPES\", function() { return IMAGE_TYPES; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__MediaServices__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(4);\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n\nvar DEFAULT_IMAGE_TYPE = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].IMAGE_TYPES.PNG;\n\nvar CameraPhoto = function () {\n function CameraPhoto(videoElement) {\n _classCallCheck(this, CameraPhoto);\n\n this.videoElement = videoElement;\n this.stream = null;\n this.numberOfMaxResolutionTry = 1;\n this.settings = null;\n\n // Set the right object depending on the browser.\n this.windowURL = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].getWindowURL();\n this.mediaDevices = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].getNavigatorMediaDevices();\n }\n\n _createClass(CameraPhoto, [{\n key: '_getStreamDevice',\n value: function _getStreamDevice(idealFacingMode, idealResolution) {\n var _this = this;\n\n return new Promise(function (resolve, reject) {\n var constraints = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].getIdealConstraints(idealFacingMode, idealResolution);\n\n _this.mediaDevices.getUserMedia(constraints).then(function (stream) {\n _this._gotStream(stream);\n resolve(stream);\n }).catch(function (error) {\n // let {name, constraint, message} = error;\n // window.alert(name + ' ' + constraint + ' ' + message);\n reject(error);\n });\n });\n }\n }, {\n key: '_getStreamDeviceMaxResolution',\n value: function _getStreamDeviceMaxResolution(idealFacingMode) {\n var _this2 = this;\n\n var constraints = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].getMaxResolutionConstraints(idealFacingMode, this.numberOfMaxResolutionTry);\n\n // all the trying is done...\n if (constraints == null) {\n var idealResolution = {};\n return this._getStreamDevice(idealFacingMode, idealResolution);\n }\n\n return new Promise(function (resolve, reject) {\n _this2.mediaDevices.getUserMedia(constraints).then(function (stream) {\n _this2._gotStream(stream);\n resolve(stream);\n }).catch(function (error) {\n var name = error.name,\n constraint = error.constraint,\n message = error.message;\n\n console.error(name + ' ' + constraint + ' ' + message);\n // retry...\n setTimeout(function () {\n _this2.numberOfMaxResolutionTry += 1;\n _this2._getStreamDeviceMaxResolution(idealFacingMode);\n }, 20);\n });\n });\n }\n }, {\n key: '_setVideoSrc',\n value: function _setVideoSrc(stream) {\n if ('srcObject' in this.videoElement) {\n this.videoElement.srcObject = stream;\n } else {\n // using URL.createObjectURL() as fallback for old browsers\n var videoSrc = this.windowURL.createObjectURL(stream);\n this.videoElement.src = videoSrc;\n }\n }\n }, {\n key: '_setSettings',\n value: function _setSettings(stream) {\n // default setting is null\n this.settings = null;\n if (stream) {\n this.settings = this.stream.getTracks()[0].getSettings();\n }\n }\n }, {\n key: '_gotStream',\n value: function _gotStream(stream) {\n this.stream = stream;\n this._setSettings(stream);\n this._setVideoSrc(stream);\n }\n }, {\n key: 'getCameraSettings',\n value: function getCameraSettings() {\n return this.settings;\n }\n }, {\n key: 'startCamera',\n value: function startCamera(idealFacingMode, idealResolution) {\n var _this3 = this;\n\n // stop the stream before playing it.\n return this.stopCamera().then(function () {}).catch(function () {})\n // Always called (when the promise is done)\n .then(function () {\n return _this3._getStreamDevice(idealFacingMode, idealResolution);\n });\n }\n }, {\n key: 'startCameraMaxResolution',\n value: function startCameraMaxResolution() {\n var _this4 = this;\n\n var idealFacingMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n // stop the stream before playing it.\n return this.stopCamera().then(function () {}).catch(function () {})\n // Always called (when the promise is done)\n .then(function () {\n return _this4._getStreamDeviceMaxResolution(idealFacingMode);\n });\n }\n }, {\n key: 'getDataUri',\n value: function getDataUri(userConfig) {\n var config = {\n sizeFactor: userConfig.sizeFactor === undefined ? __WEBPACK_IMPORTED_MODULE_1__constants__[\"c\" /* DEFAULT_SIZE_FACTOR */] : userConfig.sizeFactor,\n imageType: userConfig.imageType === undefined ? DEFAULT_IMAGE_TYPE : userConfig.imageType,\n imageCompression: userConfig.imageCompression === undefined ? __WEBPACK_IMPORTED_MODULE_1__constants__[\"a\" /* DEFAULT_IMAGE_COMPRESSION */] : userConfig.imageCompression,\n isImageMirror: userConfig.isImageMirror === undefined ? __WEBPACK_IMPORTED_MODULE_1__constants__[\"b\" /* DEFAULT_IMAGE_MIRROR */] : userConfig.isImageMirror\n };\n\n var dataUri = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].getDataUri(this.videoElement, config);\n return dataUri;\n }\n }, {\n key: 'stopCamera',\n value: function stopCamera() {\n var _this5 = this;\n\n return new Promise(function (resolve, reject) {\n if (_this5.stream) {\n _this5.stream.getTracks().forEach(function (track) {\n track.stop();\n });\n _this5.videoElement.src = '';\n _this5.stream = null;\n _this5._setSettings(null);\n resolve();\n }\n reject(Error('no stream to stop!'));\n });\n }\n }]);\n\n return CameraPhoto;\n}();\n\nvar FACING_MODES = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].FACING_MODES;\nvar IMAGE_TYPES = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* default */].IMAGE_TYPES;\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (CameraPhoto);\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helper__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(0);\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n\nvar MediaServices = function () {\n function MediaServices() {\n _classCallCheck(this, MediaServices);\n }\n\n _createClass(MediaServices, null, [{\n key: 'getDataUri',\n value: function getDataUri(videoElement, config) {\n var sizeFactor = config.sizeFactor,\n imageType = config.imageType,\n imageCompression = config.imageCompression,\n isImageMirror = config.isImageMirror;\n var videoWidth = videoElement.videoWidth,\n videoHeight = videoElement.videoHeight;\n\n var _getImageSize = Object(__WEBPACK_IMPORTED_MODULE_0__helper__[\"b\" /* getImageSize */])(videoWidth, videoHeight, sizeFactor),\n imageWidth = _getImageSize.imageWidth,\n imageHeight = _getImageSize.imageHeight;\n\n // Build the canvas size et draw the image to context from videoElement\n\n\n var canvas = document.createElement('canvas');\n canvas.width = imageWidth;\n canvas.height = imageHeight;\n var context = canvas.getContext('2d');\n\n // Flip horizontally (as css transform: rotateY(180deg))\n if (isImageMirror) {\n context.setTransform(-1, 0, 0, 1, canvas.width, 0);\n }\n\n context.drawImage(videoElement, 0, 0, imageWidth, imageHeight);\n\n // Get dataUri from canvas\n var dataUri = Object(__WEBPACK_IMPORTED_MODULE_0__helper__[\"a\" /* getDataUri */])(canvas, imageType, imageCompression);\n return dataUri;\n }\n }, {\n key: 'getWindowURL',\n value: function getWindowURL() {\n var windowURL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n return windowURL;\n }\n\n /*\n Inspiration : https://github.com/jhuckaby/webcamjs/blob/master/webcam.js\n */\n\n }, {\n key: 'getNavigatorMediaDevices',\n value: function getNavigatorMediaDevices() {\n var NMDevice = null;\n var isNewAPI = !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia);\n var isOldAPI = !!(navigator.mozGetUserMedia || navigator.webkitGetUserMedia);\n\n if (isNewAPI) {\n NMDevice = navigator.mediaDevices;\n } else if (isOldAPI) {\n var NMDeviceOld = navigator.mozGetUserMedia || navigator.webkitGetUserMedia;\n // Setup getUserMedia, with polyfill for older browsers\n // Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n\n var polyfillGetUserMedia = {\n getUserMedia: function getUserMedia(constraint) {\n return new Promise(function (resolve, reject) {\n NMDeviceOld.call(navigator, constraint, resolve, reject);\n });\n }\n };\n\n // Overwrite getUserMedia() with the polyfill\n NMDevice = Object.assign(NMDeviceOld, polyfillGetUserMedia);\n }\n\n // If is no navigator.mediaDevices || navigator.mozGetUserMedia || navigator.webkitGetUserMedia\n // then is not supported so return null\n return NMDevice;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints\n\n }, {\n key: 'isSupportedFacingMode',\n value: function isSupportedFacingMode() {\n // navigator.mediaDevices\n return MediaServices.getNavigatorMediaDevices().getSupportedConstraints().facingMode;\n }\n }, {\n key: 'getIdealConstraints',\n value: function getIdealConstraints(idealFacingMode, idealResolution) {\n // default idealConstraints\n var idealConstraints = {\n audio: false,\n video: {}\n };\n\n if (Object(__WEBPACK_IMPORTED_MODULE_0__helper__[\"c\" /* isMinimumConstraints */])(idealFacingMode, idealResolution)) {\n return __WEBPACK_IMPORTED_MODULE_1__constants__[\"d\" /* MINIMUM_CONSTRAINTS */];\n }\n\n var supports = navigator.mediaDevices.getSupportedConstraints();\n /* eslint-env browser */\n // alert(JSON.stringify(supports));\n if (!supports.width || !supports.height || !supports.facingMode) {\n console.error('Constraint width height or facingMode not supported!');\n return __WEBPACK_IMPORTED_MODULE_1__constants__[\"d\" /* MINIMUM_CONSTRAINTS */];\n }\n\n // If is valid facingMode\n if (idealFacingMode && __WEBPACK_IMPORTED_MODULE_1__constants__[\"e\" /* SUPPORTED_FACING_MODES */].includes(idealFacingMode)) {\n // idealConstraints.video.facingMode = { ideal: idealFacingMode };\n idealConstraints.video.facingMode = idealFacingMode;\n }\n\n if (idealResolution && idealResolution.width) {\n idealConstraints.video.width = idealResolution.width;\n }\n\n if (idealResolution && idealResolution.height) {\n idealConstraints.video.height = idealResolution.height;\n }\n\n return idealConstraints;\n }\n }, {\n key: 'getMaxResolutionConstraints',\n value: function getMaxResolutionConstraints() {\n var idealFacingMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var numberOfMaxResolutionTry = arguments[1];\n\n var constraints = MediaServices.getIdealConstraints(idealFacingMode);\n\n var VIDEO_ADVANCED_CONSTRANTS = [{ 'width': { 'min': 640 } }, { 'width': { 'min': 800 } }, { 'width': { 'min': 900 } }, { 'width': { 'min': 1024 } }, { 'width': { 'min': 1080 } }, { 'width': { 'min': 1280 } }, { 'width': { 'min': 1920 } }, { 'width': { 'min': 2560 } }, { 'width': { 'min': 3840 } }];\n\n if (numberOfMaxResolutionTry >= VIDEO_ADVANCED_CONSTRANTS.length) {\n return null;\n }\n\n // each number of try, we remove the last value of the array (the bigger minim width)\n var advanced = VIDEO_ADVANCED_CONSTRANTS.slice(0, -numberOfMaxResolutionTry);\n constraints.video.advanced = advanced;\n\n return constraints;\n }\n }, {\n key: 'FACING_MODES',\n get: function get() {\n return __WEBPACK_IMPORTED_MODULE_1__constants__[\"a\" /* FACING_MODES */];\n }\n }, {\n key: 'IMAGE_TYPES',\n get: function get() {\n return __WEBPACK_IMPORTED_MODULE_1__constants__[\"c\" /* IMAGE_TYPES */];\n }\n }]);\n\n return MediaServices;\n}();\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (MediaServices);\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"b\"] = getImageSize;\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = getDataUri;\n/* harmony export (immutable) */ __webpack_exports__[\"c\"] = isMinimumConstraints;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(0);\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n\n\nfunction _validateImgParam(imageType, imageCompression) {\n // validate the imageCompression\n if (!(imageCompression >= 0 && imageCompression <= 1)) {\n throw new Error(imageCompression + ' is invalid imageCompression, choose between: [0, 1]');\n }\n\n // validate the imageType\n if (!__WEBPACK_IMPORTED_MODULE_0__constants__[\"f\" /* SUPPORTED_IMAGE_TYPES */].includes(imageType)) {\n throw new Error(imageType + ' is invalid imageType, choose between: ' + __WEBPACK_IMPORTED_MODULE_0__constants__[\"f\" /* SUPPORTED_IMAGE_TYPES */].join(', '));\n }\n return true;\n}\n\nfunction _getValidImgParam(imageType, imageCompression) {\n var imgParam = {};\n try {\n _validateImgParam(imageType, imageCompression);\n imgParam.imageType = imageType;\n imgParam.imageCompression = imageCompression;\n } catch (e) {\n console.error(e);\n console.error('default value of ' + __WEBPACK_IMPORTED_MODULE_0__constants__[\"c\" /* IMAGE_TYPES */].PNG + ' is used');\n\n imgParam.imageType = __WEBPACK_IMPORTED_MODULE_0__constants__[\"c\" /* IMAGE_TYPES */].PNG;\n imgParam.imageCompression = null;\n }\n\n return imgParam;\n}\n\nfunction getImageSize(videoWidth, videoHeight, sizeFactor) {\n // calc the imageWidth\n var imageWidth = videoWidth * parseFloat(sizeFactor);\n // calc the ratio\n var ratio = videoWidth / imageWidth;\n // calc the imageHeight\n var imageHeight = videoHeight / ratio;\n\n return {\n imageWidth: imageWidth,\n imageHeight: imageHeight\n };\n}\n\nfunction getDataUri(canvas, imageType, imageCompression) {\n var imgParam = _getValidImgParam(imageType, imageCompression);\n\n if (imgParam.imageType === __WEBPACK_IMPORTED_MODULE_0__constants__[\"c\" /* IMAGE_TYPES */].JPG) {\n if (!imageCompression) {\n return canvas.toDataURL(__WEBPACK_IMPORTED_MODULE_0__constants__[\"b\" /* FORMAT_TYPES */][__WEBPACK_IMPORTED_MODULE_0__constants__[\"c\" /* IMAGE_TYPES */].JPG]);\n }\n return canvas.toDataURL(__WEBPACK_IMPORTED_MODULE_0__constants__[\"b\" /* FORMAT_TYPES */][__WEBPACK_IMPORTED_MODULE_0__constants__[\"c\" /* IMAGE_TYPES */].JPG], imageCompression);\n }\n\n return canvas.toDataURL(__WEBPACK_IMPORTED_MODULE_0__constants__[\"b\" /* FORMAT_TYPES */][imageType]);\n}\n\nfunction _isEmptyObject(obj) {\n if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object') {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction isMinimumConstraints(idealFacingMode, idealResolution) {\n return !(idealFacingMode || idealResolution && !_isEmptyObject(idealResolution));\n}\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return DEFAULT_SIZE_FACTOR; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return DEFAULT_IMAGE_COMPRESSION; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return DEFAULT_IMAGE_MIRROR; });\nvar DEFAULT_SIZE_FACTOR = 1;\nvar DEFAULT_IMAGE_COMPRESSION = null;\nvar DEFAULT_IMAGE_MIRROR = false;\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// jslib-html5-camera-photo.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b2cad8ce99ae01b067a8","// camera constants\nconst USER = 'user';\nconst ENVIRONMENT = 'environment';\n\nexport const SUPPORTED_FACING_MODES = [USER, ENVIRONMENT];\n\nexport const FACING_MODES = {\n 'USER': USER,\n 'ENVIRONMENT': ENVIRONMENT\n};\n\n// Image constants\nconst PNG = 'png';\nconst JPG = 'jpg';\n\nexport const SUPPORTED_IMAGE_TYPES = [JPG, PNG];\n\nexport const IMAGE_TYPES = {\n 'PNG': PNG,\n 'JPG': JPG\n};\n\nexport const FORMAT_TYPES = {\n [JPG]: 'image/jpeg',\n [PNG]: 'image/png'\n};\n\nexport const MINIMUM_CONSTRAINTS = {\n audio: false,\n video: true\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/MediaServices/constants.js","import MediaServices from './MediaServices';\n\nimport {\n DEFAULT_SIZE_FACTOR,\n DEFAULT_IMAGE_COMPRESSION,\n DEFAULT_IMAGE_MIRROR } from './constants';\n\nconst DEFAULT_IMAGE_TYPE = MediaServices.IMAGE_TYPES.PNG;\n\nclass CameraPhoto {\n constructor (videoElement) {\n this.videoElement = videoElement;\n this.stream = null;\n this.numberOfMaxResolutionTry = 1;\n this.settings = null;\n\n // Set the right object depending on the browser.\n this.windowURL = MediaServices.getWindowURL();\n this.mediaDevices = MediaServices.getNavigatorMediaDevices();\n }\n\n _getStreamDevice (idealFacingMode, idealResolution) {\n return new Promise((resolve, reject) => {\n let constraints =\n MediaServices.getIdealConstraints(idealFacingMode, idealResolution);\n\n this.mediaDevices.getUserMedia(constraints)\n .then((stream) => {\n this._gotStream(stream);\n resolve(stream);\n })\n .catch((error) => {\n // let {name, constraint, message} = error;\n // window.alert(name + ' ' + constraint + ' ' + message);\n reject(error);\n });\n });\n }\n\n _getStreamDeviceMaxResolution (idealFacingMode) {\n let constraints =\n MediaServices.getMaxResolutionConstraints(idealFacingMode, this.numberOfMaxResolutionTry);\n\n // all the trying is done...\n if (constraints == null) {\n let idealResolution = {};\n return this._getStreamDevice(idealFacingMode, idealResolution);\n }\n\n return new Promise((resolve, reject) => {\n this.mediaDevices.getUserMedia(constraints)\n .then((stream) => {\n this._gotStream(stream);\n resolve(stream);\n })\n .catch((error) => {\n let {name, constraint, message} = error;\n console.error(name + ' ' + constraint + ' ' + message);\n // retry...\n setTimeout(() => {\n this.numberOfMaxResolutionTry += 1;\n this._getStreamDeviceMaxResolution(idealFacingMode);\n }, 20);\n });\n });\n }\n\n _setVideoSrc (stream) {\n if ('srcObject' in this.videoElement) {\n this.videoElement.srcObject = stream;\n } else {\n // using URL.createObjectURL() as fallback for old browsers\n let videoSrc = this.windowURL.createObjectURL(stream);\n this.videoElement.src = videoSrc;\n }\n }\n\n _setSettings (stream) {\n // default setting is null\n this.settings = null;\n if (stream) {\n this.settings = this.stream.getTracks()[0].getSettings();\n }\n }\n\n _gotStream (stream) {\n this.stream = stream;\n this._setSettings(stream);\n this._setVideoSrc(stream);\n }\n\n getCameraSettings () {\n return this.settings;\n }\n\n startCamera (idealFacingMode, idealResolution) {\n // stop the stream before playing it.\n return this.stopCamera()\n .then(() => {})\n .catch(() => {})\n // Always called (when the promise is done)\n .then(() => {\n return this._getStreamDevice(idealFacingMode, idealResolution);\n });\n }\n\n startCameraMaxResolution (idealFacingMode = {}) {\n // stop the stream before playing it.\n return this.stopCamera()\n .then(() => {})\n .catch(() => {})\n // Always called (when the promise is done)\n .then(() => {\n return this._getStreamDeviceMaxResolution(idealFacingMode);\n });\n }\n\n getDataUri (userConfig) {\n let config = {\n sizeFactor: userConfig.sizeFactor === undefined ? DEFAULT_SIZE_FACTOR : userConfig.sizeFactor,\n imageType: userConfig.imageType === undefined ? DEFAULT_IMAGE_TYPE : userConfig.imageType,\n imageCompression: userConfig.imageCompression === undefined ? DEFAULT_IMAGE_COMPRESSION : userConfig.imageCompression,\n isImageMirror: userConfig.isImageMirror === undefined ? DEFAULT_IMAGE_MIRROR : userConfig.isImageMirror\n };\n\n let dataUri = MediaServices.getDataUri(this.videoElement, config);\n return dataUri;\n }\n\n stopCamera () {\n return new Promise((resolve, reject) => {\n if (this.stream) {\n this.stream.getTracks().forEach(function (track) {\n track.stop();\n });\n this.videoElement.src = '';\n this.stream = null;\n this._setSettings(null);\n resolve();\n }\n reject(Error('no stream to stop!'));\n });\n }\n}\n\nexport const FACING_MODES = MediaServices.FACING_MODES;\nexport const IMAGE_TYPES = MediaServices.IMAGE_TYPES;\n\nexport default CameraPhoto;\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/index.js","import {getImageSize, getDataUri, isMinimumConstraints} from './helper';\n\nimport {\n SUPPORTED_FACING_MODES,\n FACING_MODES,\n IMAGE_TYPES,\n MINIMUM_CONSTRAINTS\n} from './constants';\n\nclass MediaServices {\n static getDataUri (videoElement, config) {\n let { sizeFactor, imageType, imageCompression, isImageMirror } = config;\n\n let {videoWidth, videoHeight} = videoElement;\n let {imageWidth, imageHeight} = getImageSize(videoWidth, videoHeight, sizeFactor);\n\n // Build the canvas size et draw the image to context from videoElement\n let canvas = document.createElement('canvas');\n canvas.width = imageWidth;\n canvas.height = imageHeight;\n let context = canvas.getContext('2d');\n\n // Flip horizontally (as css transform: rotateY(180deg))\n if (isImageMirror) {\n context.setTransform(-1, 0, 0, 1, canvas.width, 0);\n }\n\n context.drawImage(videoElement, 0, 0, imageWidth, imageHeight);\n\n // Get dataUri from canvas\n let dataUri = getDataUri(canvas, imageType, imageCompression);\n return dataUri;\n }\n\n static getWindowURL () {\n let windowURL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n return windowURL;\n }\n\n /*\n Inspiration : https://github.com/jhuckaby/webcamjs/blob/master/webcam.js\n */\n static getNavigatorMediaDevices () {\n let NMDevice = null;\n let isNewAPI = !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia);\n let isOldAPI = !!(navigator.mozGetUserMedia || navigator.webkitGetUserMedia);\n\n if (isNewAPI) {\n NMDevice = navigator.mediaDevices;\n } else if (isOldAPI) {\n let NMDeviceOld = navigator.mozGetUserMedia || navigator.webkitGetUserMedia;\n // Setup getUserMedia, with polyfill for older browsers\n // Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n\n let polyfillGetUserMedia = {\n getUserMedia: function (constraint) {\n return new Promise(function (resolve, reject) {\n NMDeviceOld.call(navigator, constraint, resolve, reject);\n });\n }\n };\n\n // Overwrite getUserMedia() with the polyfill\n NMDevice = Object.assign(NMDeviceOld,\n polyfillGetUserMedia\n );\n }\n\n // If is no navigator.mediaDevices || navigator.mozGetUserMedia || navigator.webkitGetUserMedia\n // then is not supported so return null\n return NMDevice;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints\n static isSupportedFacingMode () {\n // navigator.mediaDevices\n return MediaServices.getNavigatorMediaDevices().getSupportedConstraints().facingMode;\n }\n\n static getIdealConstraints (idealFacingMode, idealResolution) {\n // default idealConstraints\n let idealConstraints = {\n audio: false,\n video: {}\n };\n\n if (isMinimumConstraints(idealFacingMode, idealResolution)) {\n return MINIMUM_CONSTRAINTS;\n }\n\n const supports = navigator.mediaDevices.getSupportedConstraints();\n /* eslint-env browser */\n // alert(JSON.stringify(supports));\n if (!supports.width || !supports.height || !supports.facingMode) {\n console.error('Constraint width height or facingMode not supported!');\n return MINIMUM_CONSTRAINTS;\n }\n\n // If is valid facingMode\n if (idealFacingMode && SUPPORTED_FACING_MODES.includes(idealFacingMode)) {\n // idealConstraints.video.facingMode = { ideal: idealFacingMode };\n idealConstraints.video.facingMode = idealFacingMode;\n }\n\n if (idealResolution && idealResolution.width) {\n idealConstraints.video.width = idealResolution.width;\n }\n\n if (idealResolution && idealResolution.height) {\n idealConstraints.video.height = idealResolution.height;\n }\n\n return idealConstraints;\n }\n\n static getMaxResolutionConstraints (idealFacingMode = {}, numberOfMaxResolutionTry) {\n let constraints = MediaServices.getIdealConstraints(idealFacingMode);\n\n const VIDEO_ADVANCED_CONSTRANTS = [\n {'width': {'min': 640}},\n {'width': {'min': 800}},\n {'width': {'min': 900}},\n {'width': {'min': 1024}},\n {'width': {'min': 1080}},\n {'width': {'min': 1280}},\n {'width': {'min': 1920}},\n {'width': {'min': 2560}},\n {'width': {'min': 3840}}\n ];\n\n if (numberOfMaxResolutionTry >= VIDEO_ADVANCED_CONSTRANTS.length) {\n return null;\n }\n\n // each number of try, we remove the last value of the array (the bigger minim width)\n let advanced = VIDEO_ADVANCED_CONSTRANTS.slice(0, -numberOfMaxResolutionTry);\n constraints.video.advanced = advanced;\n\n return constraints;\n }\n\n static get FACING_MODES () {\n return FACING_MODES;\n }\n\n static get IMAGE_TYPES () {\n return IMAGE_TYPES;\n }\n}\n\nexport default MediaServices;\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/MediaServices/index.js","import {\n SUPPORTED_IMAGE_TYPES,\n FORMAT_TYPES,\n IMAGE_TYPES\n} from './constants';\n\nfunction _validateImgParam (imageType, imageCompression) {\n // validate the imageCompression\n if (!(imageCompression >= 0 && imageCompression <= 1)) {\n throw new Error(imageCompression + ' is invalid imageCompression, choose between: [0, 1]');\n }\n\n // validate the imageType\n if (!SUPPORTED_IMAGE_TYPES.includes(imageType)) {\n throw new Error(imageType + ' is invalid imageType, choose between: ' + SUPPORTED_IMAGE_TYPES.join(', '));\n }\n return true;\n}\n\nfunction _getValidImgParam (imageType, imageCompression) {\n let imgParam = {};\n try {\n _validateImgParam(imageType, imageCompression);\n imgParam.imageType = imageType;\n imgParam.imageCompression = imageCompression;\n } catch (e) {\n console.error(e);\n console.error('default value of ' + IMAGE_TYPES.PNG + ' is used');\n\n imgParam.imageType = IMAGE_TYPES.PNG;\n imgParam.imageCompression = null;\n }\n\n return imgParam;\n}\n\nexport function getImageSize (videoWidth, videoHeight, sizeFactor) {\n // calc the imageWidth\n let imageWidth = videoWidth * parseFloat(sizeFactor);\n // calc the ratio\n let ratio = videoWidth / imageWidth;\n // calc the imageHeight\n let imageHeight = videoHeight / ratio;\n\n return {\n imageWidth,\n imageHeight\n };\n}\n\nexport function getDataUri (canvas, imageType, imageCompression) {\n const imgParam = _getValidImgParam(imageType, imageCompression);\n\n if (imgParam.imageType === IMAGE_TYPES.JPG) {\n if (!imageCompression) {\n return canvas.toDataURL(FORMAT_TYPES[IMAGE_TYPES.JPG]);\n }\n return canvas.toDataURL(FORMAT_TYPES[IMAGE_TYPES.JPG], imageCompression);\n }\n\n return canvas.toDataURL(FORMAT_TYPES[imageType]);\n}\n\nfunction _isEmptyObject (obj) {\n if (typeof obj === 'object') {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nexport function isMinimumConstraints (idealFacingMode, idealResolution) {\n return !(idealFacingMode || (idealResolution && !_isEmptyObject(idealResolution)));\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/MediaServices/helper.js","export const DEFAULT_SIZE_FACTOR = 1;\nexport const DEFAULT_IMAGE_COMPRESSION = null;\nexport const DEFAULT_IMAGE_MIRROR = false;\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/constants.js"],"sourceRoot":""}