-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
ExponentCamera.web.js.map
1 lines (1 loc) · 7.97 KB
/
ExponentCamera.web.js.map
1
{"version":3,"file":"ExponentCamera.web.js","sourceRoot":"","sources":["../src/ExponentCamera.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAQ/E,OAAO,YAA4B,MAAM,6BAA6B,CAAC;AACvE,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,KAAK,CAAC,SAA4B;IAA9E;;QAIE,UAAK,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAYvB,uBAAkB,GAAG,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,iBAAiB,EAAqB,EAAE,EAAE;YAC5F,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;aACR;YAED,MAAM,MAAM,CAAC,YAAY,CAAC,IAAkB,CAAC,CAAC;YAE9C,MAAM,MAAM,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,CAAC;YAE7D,sDAAsD;YAEtD,MAAM,MAAM,CAAC,0BAA0B,EAAE,CAAC;YAE1C,MAAM,gBAAgB,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC;YACtD,IAAI,gBAAgB,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;gBACxC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;aAC3C;QACH,CAAC,CAAC;QAEF,cAAS,GAAG,GAAiB,EAAE;YAC7B,IAAI,IAAI,CAAC,MAAM,EAAE;gBACf,OAAO,IAAI,CAAC,MAAM,CAAC;aACpB;Y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OAAO,CACL,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAC5E;QAAA,CAAC,KAAK,CACJ,QAAQ,CACR,WAAW,CACX,KAAK,CAAC,CAAC,OAAO,CAAC,CACf,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAClB,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAExD;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CACtB;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;CACF;AAED,MAAM,KAAK,GAAQ,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAEzF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,YAAY,EAAE;QACZ,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,SAAS;KACtB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,OAAO;KACnB;CACF,CAAC,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\nimport { createElement, findNodeHandle, StyleSheet, View } from 'react-native';\n\nimport {\n CameraCapturedPicture,\n CameraMountError,\n CameraNativeProps,\n CameraPictureOptions,\n} from './Camera.types';\nimport CameraModule, { CameraType } from './CameraModule/CameraModule';\nimport CameraManager from './ExponentCameraManager.web';\n\nexport default class ExponentCamera extends React.Component<CameraNativeProps> {\n video?: number | null;\n camera?: CameraModule;\n\n state = { type: null };\n\n componentWillUnmount() {\n if (this.camera) {\n this.camera.stopAsync();\n }\n }\n\n componentDidUpdate(nextProps) {\n this._updateCameraProps(nextProps);\n }\n\n _updateCameraProps = async ({ type, pictureSize, ...webCameraSettings }: CameraNativeProps) => {\n const { camera } = this;\n if (!camera) {\n return;\n }\n\n await camera.setTypeAsync(type as CameraType);\n\n await camera.updateWebCameraSettingsAsync(webCameraSettings);\n\n // await camera.setPictureSize(pictureSize as string);\n\n await camera.ensureCameraIsRunningAsync();\n\n const actualCameraType = camera.getActualCameraType();\n if (actualCameraType !== this.state.type) {\n this.setState({ type: actualCameraType });\n }\n };\n\n getCamera = (): CameraModule => {\n if (this.camera) {\n return this.camera;\n }\n throw new Error('Camera is not defined yet!');\n };\n\n getAvailablePictureSizes = async (ratio: string): Promise<string[]> => {\n const camera = this.getCamera();\n return camera.getAvailablePictureSizes(ratio);\n };\n\n takePicture = async (options: CameraPictureOptions): Promise<CameraCapturedPicture> => {\n const camera = this.getCamera();\n return camera.takePicture({\n ...options,\n // This will always be defined, the option gets added to a queue in the upper-level. We should replace the original so it isn't called twice.\n onPictureSaved: this.props.onPictureSaved,\n });\n };\n\n resumePreview = async (): Promise<void> => {\n const camera = this.getCamera();\n await camera.resumePreview();\n };\n\n pausePreview = async (): Promise<void> => {\n const camera = this.getCamera();\n await camera.stopAsync();\n };\n\n onCameraReady = () => {\n if (this.props.onCameraReady) {\n this.props.onCameraReady();\n }\n };\n\n onMountError = ({ nativeEvent }: { nativeEvent: CameraMountError }) => {\n if (this.props.onMountError) {\n this.props.onMountError({ nativeEvent });\n }\n };\n\n _setRef = ref => {\n if (!ref) {\n this.video = null;\n if (this.camera) {\n this.camera.stopAsync();\n this.camera = undefined;\n }\n return;\n }\n this.video = findNodeHandle(ref);\n\n (this.video as any).webkitPlaysinline = true;\n\n this.camera = new CameraModule(ref);\n this.camera.onCameraReady = this.onCameraReady;\n this.camera.onMountError = this.onMountError;\n this._updateCameraProps(this.props);\n };\n\n render() {\n const { pointerEvents } = this.props;\n\n // TODO: Bacon: Create a universal prop, on native the microphone is only used when recording videos.\n // Because we don't support recording video in the browser we don't need the user to give microphone permissions.\n const isMuted = true;\n\n const isFrontFacingCamera = this.state.type === CameraManager.Type.front;\n const style = {\n // Flip the camera\n transform: isFrontFacingCamera ? [{ scaleX: -1 }] : undefined,\n };\n\n return (\n <View pointerEvents=\"box-none\" style={[styles.videoWrapper, this.props.style]}>\n <Video\n autoPlay\n playsInline\n muted={isMuted}\n pointerEvents={pointerEvents}\n ref={this._setRef}\n style={[StyleSheet.absoluteFill, styles.video, style]}\n />\n {this.props.children}\n </View>\n );\n }\n}\n\nconst Video: any = forwardRef((props, ref) => createElement('video', { ...props, ref }));\n\nconst styles = StyleSheet.create({\n videoWrapper: {\n flex: 1,\n alignItems: 'stretch',\n },\n video: {\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n },\n});\n"]}