UNPKG

react-native-nitro-screen-recorder

Version:

A library to capture screen recordings with react-native powered by NitroModules.

33 lines (30 loc) 1.85 kB
"use strict"; import { withPlugins, createRunOncePlugin, AndroidConfig } from '@expo/config-plugins'; import { withBroadcastExtension } from './ios/withBroadcastExtension'; import { withAndroidScreenRecording } from './android/withAndroidScreenRecording'; import { validatePluginProps } from './support/validatePluginProps'; const pkg = require('../../../package.json'); const CAMERA_USAGE = 'Allow $(PRODUCT_NAME) to access your camera'; const MICROPHONE_USAGE = 'Allow $(PRODUCT_NAME) to access your microphone'; const withScreenRecorder = (config, props = {}) => { validatePluginProps(props); /*---------------IOS-------------------- */ if (config.ios == null) config.ios = {}; if (config.ios.infoPlist == null) config.ios.infoPlist = {}; if (props.enableCameraPermission === true) { config.ios.infoPlist.NSCameraUsageDescription = props.cameraPermissionText ?? config.ios.infoPlist.NSCameraUsageDescription ?? CAMERA_USAGE; } if (props.enableMicrophonePermission === true) { config.ios.infoPlist.NSMicrophoneUsageDescription = props.microphonePermissionText ?? config.ios.infoPlist.NSMicrophoneUsageDescription ?? MICROPHONE_USAGE; } config = withBroadcastExtension(config, props); /*---------------ANDROID-------------------- */ const androidPermissions = [ // already conditionally added ...(props.enableMicrophonePermission !== false ? ['android.permission.RECORD_AUDIO'] : []), 'android.permission.FOREGROUND_SERVICE', 'android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION', 'android.permission.POST_NOTIFICATIONS']; return withPlugins(config, [ // Android plugins [AndroidConfig.Permissions.withPermissions, androidPermissions], [withAndroidScreenRecording, props]]); }; export default createRunOncePlugin(withScreenRecorder, pkg.name, pkg.version); //# sourceMappingURL=withScreenRecorder.js.map