-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathjslib-html5-camera-photo.min.js.map
1 lines (1 loc) · 66.1 KB
/
jslib-html5-camera-photo.min.js.map
1
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///jslib-html5-camera-photo.min.js","webpack:///webpack/bootstrap 443a2c5e51b9c3ffcbe5","webpack:///./src/lib/CameraPhoto/index.js","webpack:///./src/lib/CameraPhoto/MediaServices/index.js","webpack:///./src/lib/CameraPhoto/MediaServices/helper.js","webpack:///./src/lib/CameraPhoto/MediaServices/constants.js","webpack:///./src/lib/index.js","webpack:///./src/lib/CameraPhoto/MediaServices/MediaServices.js","webpack:///./src/lib/CameraPhoto/CameraPhoto.js","webpack:///./src/lib/CameraPhoto/constants.js","webpack:///./src/lib/plugins/index.js","webpack:///./src/lib/plugins/downloadPhoto.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__","FACING_MODES","IMAGE_TYPES","__WEBPACK_IMPORTED_MODULE_0__MediaServices__","__WEBPACK_IMPORTED_MODULE_1__CameraPhoto__","MediaServices","__WEBPACK_IMPORTED_MODULE_1__helper__","_validateImgParam","imageType","imageCompression","Error","SUPPORTED_IMAGE_TYPES","includes","join","_getValidImgParam","imgParam","e","console","error","PNG","_getStringWithPlatform","platform","window","navigator","userAgent","getImageSize","videoWidth","videoHeight","sizeFactor","imageWidth","parseFloat","imageHeight","getDataUri","canvas","JPG","toDataURL","FORMAT_TYPES","hasConstraints","idealCameraDevice","idealResolution","getIsIOS","stringWithPlatform","match","document","_getDebugPlatformInfo","log","__WEBPACK_IMPORTED_MODULE_0__constants__","_defineProperty","obj","key","value","writable","SUPPORTED_FACING_MODES","NO_CONSTRAINTS","_FORMAT_TYPES","USER","ENVIRONMENT","audio","video","__WEBPACK_IMPORTED_MODULE_0__CameraPhoto__","__WEBPACK_IMPORTED_MODULE_1__plugins__","CameraPhoto","_classCallCheck","instance","Constructor","TypeError","__WEBPACK_IMPORTED_MODULE_0__helper__","__WEBPACK_IMPORTED_MODULE_1__constants__","_createClass","defineProperties","target","props","length","descriptor","protoProps","staticProps","videoElement","config","isImageMirror","_getImageSize","createElement","width","height","context","getContext","setTransform","drawImage","URL","webkitURL","mozURL","msURL","NMDevice","isNewAPI","mediaDevices","getUserMedia","isOldAPI","mozGetUserMedia","webkitGetUserMedia","NMDeviceOld","polyfillGetUserMedia","constraint","Promise","resolve","reject","assign","getNavigatorMediaDevices","getSupportedConstraints","facingMode","supConstraints","deviceId","exact","arguments","undefined","numberOfMaxResolutionTry","warn","VIDEO_ADVANCED_CONSTRANTS","min","stdConstraints","getIdealConstraints","ideal","advanced","slice","DEFAULT_IMAGE_TYPE","stream","settings","cameras","windowURL","getWindowURL","_this","constraints","then","_gotStream","catch","_this2","getMaxResolutionConstraints","_getStreamDevice","setTimeout","_getStreamDeviceMaxResolution","srcObject","videoSrc","createObjectURL","src","tracks","getTracks","getSettings","_this3","enumerateDevices","devices","forEach","device","kind","push","err","_setSettings","_setVideoSrc","_this4","_enumerateCamerasPromise","stopCamera","track","stop","_this5","_this6","userConfig","DEFAULT_SIZE_FACTOR","DEFAULT_IMAGE_COMPRESSION","DEFAULT_IMAGE_MIRROR","_this7","__WEBPACK_IMPORTED_MODULE_0__downloadPhoto__","_dataURItoBlob","dataURI","byteString","atob","split","mimeString","ab","ArrayBuffer","ia","Uint8Array","charCodeAt","Blob","type","_padWithZeroNumber","number","Array","_getFileExtention","blobType","extention","_getFileName","prefixName","imageNumber","_downloadImageFileFomBlob","blob","anchor","download","href","mouseEvent","createEvent","initMouseEvent","dispatchEvent","downloadPhoto","dataUri"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,2BAAAH,GACA,gBAAAC,SACAA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AWE,eAAe,SAAS,GAAM,EAAM/K,OAAQ,EAAG,EAAG,EAAG,EAAG,GAAG,GAAO,GAAO,GAAO,EAAO,EAAG,MACrG0K,EAAOM,cAAcH,GAGhB,QAASI,GAAeC,GAAgD,GAAvCZ,GAAuC7E,UAAAvC,OAAA,OAAAwC,KAAAD,UAAA,GAAAA,UAAA,GAA1B,QAAS8E,EAAiB9E,UAAAvC,OAAA,OAAAwC,KAAAD,UAAA,GAAAA,UAAA,GAAH,CAE1E+E,GADWtB,EAAegC,GACMZ,EAAYC,GAvD9C7L,EAAA,EAAAuM,CAAA,IAAA5I,GAAApF,EAAA","file":"jslib-html5-camera-photo.min.js","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 = 4);\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__, \"b\", function() { return FACING_MODES; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return IMAGE_TYPES; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__MediaServices__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CameraPhoto__ = __webpack_require__(6);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return __WEBPACK_IMPORTED_MODULE_1__CameraPhoto__[\"a\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"b\"]; });\n\n\n\nvar FACING_MODES = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* MediaServices */].FACING_MODES;\nvar IMAGE_TYPES = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* MediaServices */].IMAGE_TYPES;\n\n// For debugging only\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__MediaServices__ = __webpack_require__(5);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\"]; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helper__ = __webpack_require__(2);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return __WEBPACK_IMPORTED_MODULE_1__helper__[\"a\"]; });\n\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"c\"] = getImageSize;\n/* harmony export (immutable) */ __webpack_exports__[\"b\"] = getDataUri;\n/* harmony export (immutable) */ __webpack_exports__[\"e\"] = hasConstraints;\n/* harmony export (immutable) */ __webpack_exports__[\"d\"] = getIsIOS;\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = _getDebugPlatformInfo;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(3);\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 _getStringWithPlatform() {\n // platform will be obsolete and will return empty string\n var platform = window.navigator.platform;\n var userAgent = window.navigator.userAgent;\n\n return platform || userAgent;\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 hasConstraints(idealCameraDevice, idealResolution) {\n return idealCameraDevice || idealResolution;\n}\n\n// Inspiration: https://stackoverflow.com/questions/9038625/detect-if-device-is-ios\nfunction getIsIOS() {\n var stringWithPlatform = _getStringWithPlatform();\n\n if (stringWithPlatform.match(/iPad/i) || stringWithPlatform.match(/iPhone/i) || stringWithPlatform.match(/iPod/i)) {\n return true;\n }\n\n // The new iPad return MacIntel as platform and Macintosh as userAgent\n // so the way to differentiate iPad vs mac is by checking if\n // Touch Events exist on the document\n if (stringWithPlatform.match(/Mac/i) && 'ontouchend' in document) {\n return true;\n }\n\n return false;\n}\n\n// TODO : return an object with all usefull info of the device for debugging purpose.\nfunction _getDebugPlatformInfo() {\n console.log(window.navigator.userAgent);\n console.log(window.navigator.platform);\n return {\n userAgent: window.navigator.userAgent,\n platform: window.navigator.platform,\n _getStringWithPlatform: _getStringWithPlatform(),\n getIsIOS: getIsIOS()\n };\n}\n\n/***/ }),\n/* 3 */\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 NO_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 NO_CONSTRAINTS = {\n audio: false,\n video: true\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__ = __webpack_require__(0);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"FACING_MODES\", function() { return __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__[\"b\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"IMAGE_TYPES\", function() { return __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__[\"c\"]; });\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"_getDebugPlatformInfo\", function() { return __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__[\"d\"]; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__plugins__ = __webpack_require__(8);\n/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, \"downloadPhoto\", function() { return __WEBPACK_IMPORTED_MODULE_1__plugins__[\"a\"]; });\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (__WEBPACK_IMPORTED_MODULE_0__CameraPhoto__[\"a\" /* CameraPhoto */]);\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return MediaServices; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helper__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(3);\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__[\"c\" /* 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__[\"b\" /* 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(idealCameraDevice, idealResolution) {\n if (!Object(__WEBPACK_IMPORTED_MODULE_0__helper__[\"e\" /* hasConstraints */])(idealCameraDevice, idealResolution)) {\n return __WEBPACK_IMPORTED_MODULE_1__constants__[\"d\" /* NO_CONSTRAINTS */];\n }\n\n var supConstraints = MediaServices.getNavigatorMediaDevices().getSupportedConstraints();\n if (!supConstraints.width || !supConstraints.height) {\n console.error('Constraint width or height not supported! fallback to default resolution');\n return __WEBPACK_IMPORTED_MODULE_1__constants__[\"d\" /* NO_CONSTRAINTS */];\n }\n\n var facingMode = void 0;\n var deviceId = void 0;\n\n if (idealCameraDevice) {\n var isFacingMode = __WEBPACK_IMPORTED_MODULE_1__constants__[\"e\" /* SUPPORTED_FACING_MODES */].includes(idealCameraDevice);\n if (isFacingMode) {\n facingMode = idealCameraDevice;\n } else {\n deviceId = { exact: idealCameraDevice };\n }\n }\n\n var width = idealResolution && idealResolution.width;\n var height = idealResolution && idealResolution.height;\n\n return {\n audio: false,\n video: {\n facingMode: facingMode,\n deviceId: deviceId,\n width: width,\n height: height\n }\n };\n }\n }, {\n key: 'getMaxResolutionConstraints',\n value: function getMaxResolutionConstraints() {\n var idealCameraDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var numberOfMaxResolutionTry = arguments[1];\n\n console.warn('getMaxResolutionConstraints() numberOfMaxResolutionTry:', numberOfMaxResolutionTry);\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 var stdConstraints = MediaServices.getIdealConstraints(idealCameraDevice, {});\n\n if (numberOfMaxResolutionTry === 0) {\n if (Object(__WEBPACK_IMPORTED_MODULE_0__helper__[\"d\" /* getIsIOS */])()) {\n console.warn('fallback to iOS constraints');\n // inspiration : https://www.w3.org/TR/mediacapture-streams/#example-3\n var iPhoneConstraints = MediaServices.getIdealConstraints(idealCameraDevice, {\n width: { min: 640, ideal: 3840 },\n height: { min: 480, ideal: 2160 }\n });\n return iPhoneConstraints;\n }\n\n stdConstraints.video.advanced = VIDEO_ADVANCED_CONSTRANTS;\n return stdConstraints;\n }\n\n if (numberOfMaxResolutionTry < VIDEO_ADVANCED_CONSTRANTS.length) {\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 stdConstraints.video.advanced = advanced;\n return stdConstraints;\n }\n\n // Fallback all the possibility has been tried. ie:.\n // numberOfMaxResolutionTry >= VIDEO_ADVANCED_CONSTRANTS.length\n return null;\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/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return CameraPhoto; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__MediaServices__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(7);\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\" /* MediaServices */].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 = 0;\n this.settings = null;\n this.cameras = [];\n\n // Set the right object depending on the browser.\n this.windowURL = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* MediaServices */].getWindowURL();\n this.mediaDevices = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* MediaServices */].getNavigatorMediaDevices();\n }\n\n _createClass(CameraPhoto, [{\n key: '_getStreamDevice',\n value: function _getStreamDevice(idealCameraDevice, idealResolution) {\n var _this = this;\n\n return new Promise(function (resolve, reject) {\n var constraints = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* MediaServices */].getIdealConstraints(idealCameraDevice, idealResolution);\n\n _this.mediaDevices.getUserMedia(constraints).then(function (stream) {\n _this._gotStream(stream);\n resolve(stream);\n }).catch(function (error) {\n reject(error);\n });\n });\n }\n }, {\n key: '_getStreamDeviceMaxResolution',\n value: function _getStreamDeviceMaxResolution(idealCameraDevice) {\n var _this2 = this;\n\n var constraints = __WEBPACK_IMPORTED_MODULE_0__MediaServices__[\"a\" /* MediaServices */].getMaxResolutionConstraints(idealCameraDevice, this.numberOfMaxResolutionTry);\n\n // all the trying is done...\n if (constraints == null) {\n var idealResolution = {};\n return this._getStreamDevice(idealCameraDevice, 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 setTimeout(function () {\n _this2.numberOfMaxResolutionTry += 1;\n _this2._getStreamDeviceMaxResolution(idealCameraDevice).catch(function () {\n reject(error);\n });\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 var tracks = stream && stream.getTracks ? stream.getTracks() : [];\n\n if (tracks.length > 0 && tracks[0].getSettings) {\n this.settings = tracks[0].getSettings();\n }\n }\n }, {\n key: '_enumerateCamerasPromise',\n value: function _enumerateCamerasPromise() {\n var _this3 = this;\n\n return new Promise(function (resolve, reject) {\n // only make shure the camera is sarted\n\n var cameras = [];\n _this3.mediaDevices.enumerateDevices().then(function (devices) {\n devices.forEach(function (device) {\n if (device.kind === 'videoinput' && device.deviceId) {\n cameras.push(device);\n }\n });\n resolve(cameras);\n }).catch(function (err) {\n reject(err);\n });\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: 'enumerateCameras',\n value: function enumerateCameras() {\n var _this4 = this;\n\n // If the camera is already started, return only the promise.\n if (this.stream) {\n return this._enumerateCamerasPromise();\n }\n\n // We don't know if the camera is granted so we need to start\n // and stop the camera and then return the promise.\n return this.stopCamera().then(function () {}).catch(function () {}).then(function () {\n var constraints = { video: true };\n return _this4.mediaDevices.getUserMedia(constraints).then(function (stream) {\n // Wait 20 ms before stop the camera.\n setTimeout(function () {\n stream.getTracks().forEach(function (track) {\n track.stop();\n });\n }, 20);\n }).then(function () {}).catch(function () {}).then(function () {\n return _this4._enumerateCamerasPromise();\n });\n });\n }\n }, {\n key: 'startCamera',\n value: function startCamera(idealCameraDevice, idealResolution) {\n var _this5 = 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 _this5._getStreamDevice(idealCameraDevice, idealResolution);\n });\n }\n }, {\n key: 'startCameraMaxResolution',\n value: function startCameraMaxResolution() {\n var _this6 = this;\n\n var idealCameraDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n this.numberOfMaxResolutionTry = 0;\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 _this6._getStreamDeviceMaxResolution(idealCameraDevice);\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\" /* MediaServices */].getDataUri(this.videoElement, config);\n return dataUri;\n }\n }, {\n key: 'stopCamera',\n value: function stopCamera() {\n var _this7 = this;\n\n return new Promise(function (resolve, reject) {\n if (_this7.stream) {\n _this7.stream.getTracks().forEach(function (track) {\n track.stop();\n });\n _this7.videoElement.src = '';\n _this7.stream = null;\n _this7._setSettings(null);\n resolve();\n }\n reject(Error('no stream to stop!'));\n });\n }\n }]);\n\n return CameraPhoto;\n}();\n\n/***/ }),\n/* 7 */\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/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__downloadPhoto__ = __webpack_require__(9);\n/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return __WEBPACK_IMPORTED_MODULE_0__downloadPhoto__[\"a\"]; });\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = downloadPhoto;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__ = __webpack_require__(0);\n\n\nfunction _dataURItoBlob(dataURI) {\n var byteString = atob(dataURI.split(',')[1]);\n\n // separate out the mime component\n var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];\n\n var ab = new ArrayBuffer(byteString.length);\n var ia = new Uint8Array(ab);\n for (var i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i);\n }\n\n var blob = new Blob([ab], { type: mimeString });\n return blob;\n}\n\nfunction _padWithZeroNumber(number, width) {\n number = number + '';\n return number.length >= width ? number : new Array(width - number.length + 1).join('0') + number;\n}\n\nfunction _getFileExtention(blobType) {\n // by default the extention is .png\n var extention = __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__[\"c\" /* IMAGE_TYPES */].PNG;\n\n if (blobType === 'image/jpeg') {\n extention = __WEBPACK_IMPORTED_MODULE_0__CameraPhoto__[\"c\" /* IMAGE_TYPES */].JPG;\n }\n return extention;\n}\n\nfunction _getFileName(prefixName, imageNumber, blobType) {\n var photoNumber = _padWithZeroNumber(imageNumber, 4);\n var extention = _getFileExtention(blobType);\n\n return prefixName + '-' + photoNumber + '.' + extention;\n}\n\nfunction _downloadImageFileFomBlob(blob, prefixName, imageNumber) {\n window.URL = window.webkitURL || window.URL;\n\n var anchor = document.createElement('a');\n anchor.download = _getFileName(prefixName, imageNumber, blob.type);\n anchor.href = window.URL.createObjectURL(blob);\n var mouseEvent = document.createEvent('MouseEvents');\n mouseEvent.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);\n anchor.dispatchEvent(mouseEvent);\n}\n\nfunction downloadPhoto(dataUri) {\n var prefixName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'photo';\n var imageNumber = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n var blob = _dataURItoBlob(dataUri);\n _downloadImageFileFomBlob(blob, prefixName, imageNumber);\n}\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 = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 443a2c5e51b9c3ffcbe5","import { MediaServices } from './MediaServices';\n\nexport { CameraPhoto } from './CameraPhoto';\nexport const FACING_MODES = MediaServices.FACING_MODES;\nexport const IMAGE_TYPES = MediaServices.IMAGE_TYPES;\n\n// For debugging only\nexport { _getDebugPlatformInfo } from './MediaServices';\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/CameraPhoto/index.js","export { MediaServices } from './MediaServices';\nexport { _getDebugPlatformInfo } from './helper';\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/CameraPhoto/MediaServices/index.js","import { SUPPORTED_IMAGE_TYPES, FORMAT_TYPES, IMAGE_TYPES } from './constants';\n\nfunction _validateImgParam (imageType, imageCompression) {\n // validate the imageCompression\n if (!(imageCompression >= 0 && imageCompression <= 1)) {\n throw new Error(\n imageCompression + ' is invalid imageCompression, choose between: [0, 1]'\n );\n }\n\n // validate the imageType\n if (!SUPPORTED_IMAGE_TYPES.includes(imageType)) {\n throw new Error(\n imageType +\n ' is invalid imageType, choose between: ' +\n SUPPORTED_IMAGE_TYPES.join(', ')\n );\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\nfunction _getStringWithPlatform () {\n // platform will be obsolete and will return empty string\n const platform = window.navigator.platform;\n const userAgent = window.navigator.userAgent;\n\n return platform || userAgent;\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\nexport function hasConstraints (idealCameraDevice, idealResolution) {\n return idealCameraDevice || idealResolution;\n}\n\n// Inspiration: https://stackoverflow.com/questions/9038625/detect-if-device-is-ios\nexport function getIsIOS () {\n const stringWithPlatform = _getStringWithPlatform();\n\n if (stringWithPlatform.match(/iPad/i) ||\n stringWithPlatform.match(/iPhone/i) ||\n stringWithPlatform.match(/iPod/i)) {\n return true;\n }\n\n // The new iPad return MacIntel as platform and Macintosh as userAgent\n // so the way to differentiate iPad vs mac is by checking if\n // Touch Events exist on the document\n if (stringWithPlatform.match(/Mac/i) && 'ontouchend' in document) {\n return true;\n }\n\n return false;\n}\n\n// TODO : return an object with all usefull info of the device for debugging purpose.\nexport function _getDebugPlatformInfo () {\n console.log(window.navigator.userAgent);\n console.log(window.navigator.platform);\n return {\n userAgent: window.navigator.userAgent,\n platform: window.navigator.platform,\n _getStringWithPlatform: _getStringWithPlatform(),\n getIsIOS: getIsIOS()\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/CameraPhoto/MediaServices/helper.js","// 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 NO_CONSTRAINTS = {\n audio: false,\n video: true\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/CameraPhoto/MediaServices/constants.js","import { CameraPhoto } from './CameraPhoto';\n\nexport { FACING_MODES, IMAGE_TYPES, _getDebugPlatformInfo } from './CameraPhoto';\nexport * from './plugins';\nexport default CameraPhoto;\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/index.js","import { getImageSize, getDataUri, hasConstraints, getIsIOS } from './helper';\n\nimport {\n SUPPORTED_FACING_MODES,\n FACING_MODES,\n IMAGE_TYPES,\n NO_CONSTRAINTS\n} from './constants';\n\nexport class 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 =\n 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, 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 static isSupportedFacingMode () {\n // navigator.mediaDevices\n return MediaServices.getNavigatorMediaDevices().getSupportedConstraints().facingMode;\n }\n\n static getIdealConstraints (idealCameraDevice, idealResolution) {\n if (!hasConstraints(idealCameraDevice, idealResolution)) {\n return NO_CONSTRAINTS;\n }\n\n const supConstraints = MediaServices.getNavigatorMediaDevices().getSupportedConstraints();\n if (!supConstraints.width || !supConstraints.height) {\n console.error(\n 'Constraint width or height not supported! fallback to default resolution'\n );\n return NO_CONSTRAINTS;\n }\n\n let facingMode;\n let deviceId;\n\n if (idealCameraDevice) {\n const isFacingMode = SUPPORTED_FACING_MODES.includes(idealCameraDevice);\n if (isFacingMode) {\n facingMode = idealCameraDevice;\n } else {\n deviceId = { exact: idealCameraDevice };\n }\n }\n\n const width = idealResolution && idealResolution.width;\n const height = idealResolution && idealResolution.height;\n\n return {\n audio: false,\n video: {\n facingMode,\n deviceId,\n width,\n height\n }\n };\n }\n\n static getMaxResolutionConstraints (idealCameraDevice = '', numberOfMaxResolutionTry) {\n console.warn('getMaxResolutionConstraints() numberOfMaxResolutionTry:', numberOfMaxResolutionTry);\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 let stdConstraints = MediaServices.getIdealConstraints(idealCameraDevice, {});\n\n if (numberOfMaxResolutionTry === 0) {\n if (getIsIOS()) {\n console.warn('fallback to iOS constraints');\n // inspiration : https://www.w3.org/TR/mediacapture-streams/#example-3\n let iPhoneConstraints = MediaServices.getIdealConstraints(idealCameraDevice, {\n width: { min: 640, ideal: 3840 },\n height: { min: 480, ideal: 2160 }\n });\n return iPhoneConstraints;\n }\n\n stdConstraints.video.advanced = VIDEO_ADVANCED_CONSTRANTS;\n return stdConstraints;\n }\n\n if (numberOfMaxResolutionTry < VIDEO_ADVANCED_CONSTRANTS.length) {\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 stdConstraints.video.advanced = advanced;\n return stdConstraints;\n }\n\n // Fallback all the possibility has been tried. ie:.\n // numberOfMaxResolutionTry >= VIDEO_ADVANCED_CONSTRANTS.length\n return null;\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\n\n\n// WEBPACK FOOTER //\n// ./src/lib/CameraPhoto/MediaServices/MediaServices.js","import { MediaServices } from './MediaServices';\n\nimport {\n DEFAULT_SIZE_FACTOR,\n DEFAULT_IMAGE_COMPRESSION,\n DEFAULT_IMAGE_MIRROR\n} from './constants';\n\nconst DEFAULT_IMAGE_TYPE = MediaServices.IMAGE_TYPES.PNG;\n\nexport class CameraPhoto {\n constructor (videoElement) {\n this.videoElement = videoElement;\n this.stream = null;\n this.numberOfMaxResolutionTry = 0;\n this.settings = null;\n this.cameras = [];\n\n // Set the right object depending on the browser.\n this.windowURL = MediaServices.getWindowURL();\n this.mediaDevices = MediaServices.getNavigatorMediaDevices();\n }\n\n _getStreamDevice (idealCameraDevice, idealResolution) {\n return new Promise((resolve, reject) => {\n let constraints = MediaServices.getIdealConstraints(idealCameraDevice, idealResolution);\n\n this.mediaDevices.getUserMedia(constraints)\n .then((stream) => {\n this._gotStream(stream);\n resolve(stream);\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n\n _getStreamDeviceMaxResolution (idealCameraDevice) {\n let constraints = MediaServices.getMaxResolutionConstraints(idealCameraDevice, this.numberOfMaxResolutionTry);\n\n // all the trying is done...\n if (constraints == null) {\n let idealResolution = {};\n return this._getStreamDevice(idealCameraDevice, 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 setTimeout(() => {\n this.numberOfMaxResolutionTry += 1;\n this._getStreamDeviceMaxResolution(idealCameraDevice)\n .catch(() => {\n reject(error);\n });\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 const tracks = (stream && stream.getTracks)\n ? stream.getTracks()\n : [];\n\n if (tracks.length > 0 && tracks[0].getSettings) {\n this.settings = tracks[0].getSettings();\n }\n }\n\n _enumerateCamerasPromise () {\n return new Promise((resolve, reject) => {\n // only make shure the camera is sarted\n\n let cameras = [];\n this.mediaDevices.enumerateDevices()\n .then(function (devices) {\n devices.forEach(function (device) {\n if (device.kind === 'videoinput' && device.deviceId) {\n cameras.push(device);\n }\n });\n resolve(cameras);\n })\n .catch(function (err) {\n reject(err);\n });\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 enumerateCameras () {\n // If the camera is already started, return only the promise.\n if (this.stream) {\n return this._enumerateCamerasPromise();\n }\n\n // We don't know if the camera is granted so we need to start\n // and stop the camera and then return the promise.\n return this.stopCamera()\n .then(() => { })\n .catch(() => { })\n .then(() => {\n const constraints = { video: true };\n return this.mediaDevices.getUserMedia(constraints)\n .then((stream) => {\n // Wait 20 ms before stop the camera.\n setTimeout(() => {\n stream.getTracks().forEach(function (track) {\n track.stop();\n });\n }, 20);\n })\n .then(() => { })\n .catch(() => { })\n .then(() => {\n return this._enumerateCamerasPromise();\n });\n });\n }\n\n startCamera (idealCameraDevice, 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(idealCameraDevice, idealResolution);\n });\n }\n\n startCameraMaxResolution (idealCameraDevice = '') {\n this.numberOfMaxResolutionTry = 0;\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(idealCameraDevice);\n });\n }\n\n getDataUri (userConfig) {\n let config = {\n sizeFactor: userConfig.sizeFactor === undefined\n ? DEFAULT_SIZE_FACTOR\n : userConfig.sizeFactor,\n imageType: userConfig.imageType === undefined\n ? DEFAULT_IMAGE_TYPE\n : userConfig.imageType,\n imageCompression: userConfig.imageCompression === undefined\n ? DEFAULT_IMAGE_COMPRESSION\n : userConfig.imageCompression,\n isImageMirror: userConfig.isImageMirror === undefined\n ? DEFAULT_IMAGE_MIRROR\n : 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\n\n\n// WEBPACK FOOTER //\n// ./src/lib/CameraPhoto/CameraPhoto.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/CameraPhoto/constants.js","export { downloadPhoto } from './downloadPhoto';\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/plugins/index.js","import { IMAGE_TYPES } from '../CameraPhoto';\n\nfunction _dataURItoBlob (dataURI) {\n let byteString = atob(dataURI.split(',')[1]);\n\n // separate out the mime component\n let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];\n\n let ab = new ArrayBuffer(byteString.length);\n let ia = new Uint8Array(ab);\n for (let i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i);\n }\n\n let blob = new Blob([ab], { type: mimeString });\n return blob;\n}\n\nfunction _padWithZeroNumber (number, width) {\n number = number + '';\n return number.length >= width\n ? number\n : new Array(width - number.length + 1).join('0') + number;\n}\n\nfunction _getFileExtention (blobType) {\n // by default the extention is .png\n let extention = IMAGE_TYPES.PNG;\n\n if (blobType === 'image/jpeg') {\n extention = IMAGE_TYPES.JPG;\n }\n return extention;\n}\n\nfunction _getFileName (prefixName, imageNumber, blobType) {\n const photoNumber = _padWithZeroNumber(imageNumber, 4);\n const extention = _getFileExtention(blobType);\n\n return `${prefixName}-${photoNumber}.${extention}`;\n}\n\nfunction _downloadImageFileFomBlob (blob, prefixName, imageNumber) {\n window.URL = window.webkitURL || window.URL;\n\n let anchor = document.createElement('a');\n anchor.download = _getFileName(prefixName, imageNumber, blob.type);\n anchor.href = window.URL.createObjectURL(blob);\n let mouseEvent = document.createEvent('MouseEvents');\n mouseEvent.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);\n anchor.dispatchEvent(mouseEvent);\n}\n\nexport function downloadPhoto (dataUri, prefixName = 'photo', imageNumber = 0) {\n let blob = _dataURItoBlob(dataUri);\n _downloadImageFileFomBlob(blob, prefixName, imageNumber);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/plugins/downloadPhoto.js"],"sourceRoot":""}