1.2.3 • Published 6 months ago
@supsis/visitor-rn v1.2.3
Supsis Visitor
This is a React Native component to easily add Supsis Visitor screen to your application.
Installation
npm install @supsis/visitor-rn react-native-webview@^13.12.4
or
yarn add @supsis/visitor-rn react-native-webview@^13.12.4
Prerequisites
- iOS - To enable camera and microphone access in your app, add the following keys to your Info.plist file:
<key>NSCameraUsageDescription</key>
<string>Camera access is required for live video calls</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for live video calls</string>
- Android - Add the following permissions to your AndroidManifest.xml file(Most of using for video & audio chat ):
<uses-permission android:name="android.permission.INTERNET" />
<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"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
To use SupsisVisitor in your React application, you will need the Supsis license ID.
domainName
- Defines the name of your application- For instance , namespace -
mycompany
- for mycompany.supsis.live If you don't have an account, you can create one here.
Usage
import { RefsInterface, SupsisVisitor } from "@supsis/visitor-rn";
// ...
const supsisRef = useRef < RefsInterface > null;
return (
<Container>
<SupsisVisitor ref={supsisRef} domainName={"DOMAIN_NAME"} />
</Container>
);
Commands for refs
Example:
supsisRef.current?.setUserData({
email: "John@doe.com",
});
Visitor Connected & Destroyed Chat
import { RefsInterface, SupsisVisitor } from "@supsis/visitor-rn";
const supsisRef = useRef < RefsInterface > null;
const onDisconnected: void = () => {
console.log("Visitor Disconnected from Chat!");
};
const onConnected: void = () => {
console.log("Visitor Disconnected from Chat!");
};
return (
<Container>
<SupsisVisitor
ref={supsisRef}
domainName={"DOMAIN_NAME"}
onDisconnected={onDisconnected}
onConnected={onConnected}
/>
</Container>
);
Support
If you need any help, you can chat with us here.
I hope you will find this module useful. Happy coding!