feat: Separate usecases (decouple microphone, video, photo) (#168)
* Add props * add props (iOS) * Add use-cases conditionally * Update CameraView+RecordVideo.swift * Update RecordingSession.swift * reconfigure on change * Throw correct errors * Check for audio permission * Move `#if` outward * Throw appropriate errors * Update CameraView+RecordVideo.swift * fix Splashscreen * Dynamic filePath * Fix video extension * add `avci` and `m4v` file types * Fix RecordVideo errors * Fix audio setup * Enable `photo`, `video` and `audio` * Check for `video={true}` in frameProcessor * format * Remove unused DispatchQueue * Update docs * Add `supportsPhotoAndVideoCapture` * Fix view manager * Fix error not being propagated * Catch normal errors too * Update DEVICES.mdx * Update CAPTURING.mdx * Update classdocs
This commit is contained in:
@@ -214,6 +214,9 @@ export const CameraPage: NavigationFunctionComponent = ({ componentId }) => {
|
||||
onError={onError}
|
||||
enableZoomGesture={false}
|
||||
animatedProps={cameraAnimatedProps}
|
||||
photo={true}
|
||||
video={true}
|
||||
audio={true}
|
||||
// frameProcessor={frameProcessor}
|
||||
// frameProcessorFps={1}
|
||||
/>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import type { ImageRequireSource } from 'react-native';
|
||||
import { ImageRequireSource, Linking } from 'react-native';
|
||||
|
||||
import { StyleSheet, View, Text, Image } from 'react-native';
|
||||
import { Navigation, NavigationFunctionComponent } from 'react-native-navigation';
|
||||
@@ -17,6 +17,8 @@ export const Splash: NavigationFunctionComponent = ({ componentId }) => {
|
||||
console.log('Requesting microphone permission...');
|
||||
const permission = await Camera.requestMicrophonePermission();
|
||||
console.log(`Microphone permission status: ${permission}`);
|
||||
|
||||
if (permission === 'denied') Linking.openSettings();
|
||||
setMicrophonePermissionStatus(permission);
|
||||
}, []);
|
||||
|
||||
@@ -24,6 +26,8 @@ export const Splash: NavigationFunctionComponent = ({ componentId }) => {
|
||||
console.log('Requesting camera permission...');
|
||||
const permission = await Camera.requestCameraPermission();
|
||||
console.log(`Camera permission status: ${permission}`);
|
||||
|
||||
if (permission === 'denied') Linking.openSettings();
|
||||
setCameraPermissionStatus(permission);
|
||||
}, []);
|
||||
|
||||
@@ -43,14 +47,14 @@ export const Splash: NavigationFunctionComponent = ({ componentId }) => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (cameraPermissionStatus === 'authorized' && microphonePermissionStatus === 'authorized') {
|
||||
if (cameraPermissionStatus === 'authorized' && microphonePermissionStatus !== 'not-determined') {
|
||||
Navigation.setRoot({
|
||||
root: {
|
||||
stack: {
|
||||
children: [
|
||||
{
|
||||
component: {
|
||||
name: 'Home',
|
||||
name: 'CameraPage',
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -73,7 +77,7 @@ export const Splash: NavigationFunctionComponent = ({ componentId }) => {
|
||||
</Text>
|
||||
</Text>
|
||||
)}
|
||||
{microphonePermissionStatus !== 'authorized' && (
|
||||
{microphonePermissionStatus === 'not-determined' && (
|
||||
<Text style={styles.permissionText}>
|
||||
Vision Camera needs <Text style={styles.bold}>Microphone permission</Text>.
|
||||
<Text style={styles.hyperlink} onPress={requestMicrophonePermission}>
|
||||
|
Reference in New Issue
Block a user