"use strict";var e=require("../../../_virtual/_commonjsHelpers.js"),r=require("../../../_virtual/requestMediaPermissions.js");require("../../bowser/es5.js");var s=require("../../../_virtual/es5.js");!function(r){var o=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.requestVideoPermissions=r.requestAudioPermissions=r.requestMediaPermissions=r.MediaPermissionsErrorType=void 0;const i=o(s.exports);var t;!function(e){e.SystemPermissionDenied="SystemPermissionDenied",e.UserPermissionDenied="UserPermissionDenied",e.CouldNotStartVideoSource="CouldNotStartVideoSource",e.Generic="Generic"}(t=r.MediaPermissionsErrorType||(r.MediaPermissionsErrorType={}));r.requestMediaPermissions=e=>new Promise(((r,s)=>{navigator.mediaDevices.getUserMedia(null!=e?e:{audio:!0,video:!0}).then((e=>{e.getTracks().forEach((e=>{e.stop()})),r(!0)})).catch((e=>{const r=i.default.getParser(window.navigator.userAgent).getBrowserName(),o=e.name,n=e.message;let d=t.Generic;"Chrome"===r?"NotAllowedError"===o?"Permission denied by system"===n?d=t.SystemPermissionDenied:"Permission denied"===n&&(d=t.UserPermissionDenied):"NotReadableError"===o&&(d=t.CouldNotStartVideoSource):"Safari"===r?"NotAllowedError"===o&&(d=t.UserPermissionDenied):"Microsoft Edge"===r?"NotAllowedError"===o?d=t.UserPermissionDenied:"NotReadableError"===o&&(d=t.CouldNotStartVideoSource):"Firefox"===r&&("NotFoundError"===o||"NotReadableError"===o?d=t.SystemPermissionDenied:"NotAllowedError"===o?d=t.UserPermissionDenied:"AbortError"===o&&(d=t.CouldNotStartVideoSource)),s({type:d,name:e.name,message:e.message})}))}));r.requestAudioPermissions=()=>(0,r.requestMediaPermissions)({audio:!0,video:!1});r.requestVideoPermissions=()=>(0,r.requestMediaPermissions)({audio:!1,video:!0})}(r.__exports);
//# sourceMappingURL=requestMediaPermissions.js.map
