React Native SDK for OpenTok platform.
| Prop | Type |
|---|---|
| apiKey | string |
| sessionId | string |
| token | string |
| ------------ | ------------- |
| spinnerContainerStyle | object |
| ------------ | ------------- |
| onPublishStart | function |
| onPublishError | function |
| onPublishStop | function |
| ------------ | ------------- |
| onSubscribeStart | function |
| onSubscribeError | function |
| onSubscribeStop | function |
| ------------ | ------------- |
| publishAudio | bool |
| publishVideo | bool |
import { PublisherView } from 'react-native-opentok';
export default function Publisher() {
return (
<PublisherView
apiKey={OPENTOK_API_KEY}
sessionId={OPENTOK_SESSION_ID}
token={OPENTOK_PUBLISHER_TOKEN}
style={{ width: 300, height: 200 }}
/>
);
}import { SubscriberView } from 'react-native-opentok';
export default function Subscriber() {
return (
<SubscriberView
apiKey={OPENTOK_API_KEY}
sessionId={OPENTOK_SESSION_ID}
token={OPENTOK_SUBSCRIBER_TOKEN}
style={{ width: 300, height: 200 }}
/>
);
}import { Session } from 'react-native-opentok';
Session.connect(OPENTOK_API_KEY, SESSION_ID, PUBLISHER_TOKEN || SUBSCRIBER_TOKEN);
Session.onMessageRecieved((e) => console.log(e));
Session.sendMessage('message');