react-native-covideo
TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

Installation

yarn add react-native-covideo

Install dependencies

PeerDependencies

yarn add react-native-async-storage/async-storage
yarn add react-native-background-upload
yarn add react-native-keep-awake
yarn add react-native-progress
yarn add react-native-video
yarn add react-native-sensors

Direct Dependencies

    "axios": "^0.21.1",
    "axios-hooks": "^2.4.1",
    "dayjs": "^1.10.4",
    "jwt-decode": "^3.1.2",
    "react-timer-hook": "^2.0.7"

Install pods

cd ios
pod install

Add permissions

ios

	<key>NSCameraUsageDescription</key>
	<string>Your message to user when the camera is accessed for the first time</string>

	<!-- Required with iOS 11 and higher: include this only if you are planning to use the camera roll -->
	<key>NSPhotoLibraryAddUsageDescription</key>
	<string>Your message to user when the photo library is accessed for the first time</string>

	<!-- Include this only if you are planning to use the camera roll -->
	<key>NSPhotoLibraryUsageDescription</key>
	<string>Your message to user when the photo library is accessed for the first time</string>

	<!-- Include this only if you are planning to use the microphone for video recording -->
	<key>NSMicrophoneUsageDescription</key>
	<string>Your message to user when the microphone is accessed for the first time</string>

android

 <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Example usage

Assign apikey in the App entry file.

import { Covideo } from 'react-native-covideo'
...
const App = () => {
  Covideo.apiKey = "xxx-xxx-xxx-xxx"
  ...
}

Component usage

import { Covideo } from "react-native-covideo";

const SomeView = () => {
  const [shareLink, setShareLink] = React.useState("");
  const [thumnail, setThumnail] = React.useState("");
  return (
    <SafeAreaView>
      <Text>Some title</Text>
      <Covideo
        render={({ getShareLink }) => (
          <TouchableOpacity
            onPress={() => {
              getShareLink("example@covideo.com", "www.covideo.com")
                .then((value) => {
                  console.log(value);
                  setShareLink(value.url);
                  setThumnail(value.thumbnail);
                })
                .catch((error) => {
                  setShareLink(error);
                });
            }}
          >
            <Text>get sharelink</Text>
          </TouchableOpacity>
        )}
      />
      <View style={{ marginTop: 8 }}>
        <Text>Thumbnail</Text>
        <Image source={{ uri: thumnail, height: 200 }} resizeMode={"contain"} />
        <Text>Sharelink</Text>
        <Text
          onPress={() => Linking.openURL(shareLink)}
          style={{
            color: "blue",
            width: "100%",
            paddingTop: 8,
            fontWeight: "bold",
          }}
        >
          {shareLink}
        </Text>
      </View>
    </SafeAreaView>
  );
};

export default SomeView;

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-covideo

Weekly Downloads

3

Version

0.7.0

License

GNU GPLv2

Unpacked Size

1.44 MB

Total Files

294

Last publish

Collaborators

  • appadmin-covideo