UNPKG

react-native-nitro-screen-recorder

Version:

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

37 lines (34 loc) 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _configPlugins = require("@expo/config-plugins"); var _withBroadcastExtension = require("./ios/withBroadcastExtension"); var _withAndroidScreenRecording = require("./android/withAndroidScreenRecording"); var _validatePluginProps = require("./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 = {}) => { (0, _validatePluginProps.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 = (0, _withBroadcastExtension.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 (0, _configPlugins.withPlugins)(config, [ // Android plugins [_configPlugins.AndroidConfig.Permissions.withPermissions, androidPermissions], [_withAndroidScreenRecording.withAndroidScreenRecording, props]]); }; var _default = exports.default = (0, _configPlugins.createRunOncePlugin)(withScreenRecorder, pkg.name, pkg.version); //# sourceMappingURL=withScreenRecorder.js.map