@closetothe/react-native-record-screen
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

Stand With Ukraine

react-native-record-screen

A screen record module for React Native.

Installation

npm install react-native-record-screen

iOS

  1. Add the permission strings to your Info.plist
<key>NSCameraUsageDescription</key>
<string>Please allow use of camera</string>
<!-- If you intend to use the microphone -->
<key>NSMicrophoneUsageDescription</key>
<string>Please allow use of microphone</string>
  1. pod install
npx pod-install
  1. Add ReplayKit.framework at Link Binary With Libraries

Add ReplayKit.framework at Link Binary With Libraries

Android

  1. Add the permissions to your AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- If you intend to use the microphone -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Usage

Recording full screen

import RecordScreen, {
  RecordingStartResponse,
} from 'react-native-record-screen';

// recording start
const res = RecordScreen.startRecording().catch((error) =>
  console.error(error)
);
if (res === RecordingStartResponse.PermissionError) {
  // user denies access
}

// recording stop
const res = await RecordScreen.stopRecording().catch((error) =>
  console.warn(error)
);
if (res) {
  const url = res.result.outputURL;
}

Setting microphone

default true.

// mic off
RecordScreen.startRecording({ mic: false }).catch((error) =>
  console.error(error)
);

// recording stop
const res = await RecordScreen.stopRecording().catch((error) =>
  console.warn(error)
);
if (res) {
  const url = res.result.outputURL;
}

Adjusting bitrate / frame rate

RecordScreen.startRecording({
  bitrate: 1024000, // default 236390400
  fps: 24, // default 60
});

Clean Sandbox

RecordScreen.clean();

License

MIT

Package Sidebar

Install

npm i @closetothe/react-native-record-screen

Weekly Downloads

1

Version

0.0.9

License

MIT

Unpacked Size

74.4 kB

Total Files

23

Last publish

Collaborators

  • closetothe