0.2.0 • Published 4 years ago

@beapp/react-native-record-screen v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

react-native-record-screen

A screen record module for React Native.

  • Support iOS >= 11.0

Sorry...Android dont't support yet.(It will be supported soon.)

Installation

npm install react-native-record-screen

add info.pilot

<key>NSCameraUsageDescription</key>
<string>Please allow use of camera</string>

pod install

cd ios && pod install && cd ../

Usage

Recording full screen

import RecordScreen from 'react-native-record-screen';

// recording start
RecordScreen.startRecording().catch((error) => console.error(error));

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

Croped screen

// set up RecordScreen
RecordScreen.setup({
  crop: {
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height - 180,
    x: 0,
    y: 80,
    fps: 24,
  },
});

// recording start
RecordScreen.startRecording().catch((error) => console.error(error));

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

or

// recording start
RecordScreen.startRecording({
  crop: {
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height - 180,
    x: 0,
    y: 80,
    fps: 24,
  },
}).catch((error) => console.error(error));

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

Clean Sandbox

RecordScreen.clean();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT