Socket
Socket
Sign inDemoInstall

opentok-react-native

Package Overview
Dependencies
11
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.11.2 to 0.12.0

ios/OpenTokReactNative/OTScreenCapture.h

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 0.12.0 (Aug 5, 2019)
- **[Feature]**: Add Multi-session support (merged from [PR311](https://github.com/opentok/opentok-react-native/pull/311)). Adheres to: [#218](https://github.com/opentok/opentok-react-native/issues/218), [#271](https://github.com/opentok/opentok-react-native/issues/271)
# 0.11.2 (July 2, 2019)

@@ -2,0 +8,0 @@

3

docs/EventData.md

@@ -13,2 +13,3 @@ ## Event Data

name: '',
sessionId: '',
};

@@ -67,2 +68,3 @@ ```

hasVideo: '',
sessionId: '',
creationTime: '',

@@ -90,2 +92,3 @@ height: '',

hasVideo: '',
sessionId: '',
creationTime: '',

@@ -92,0 +95,0 @@ height: '',

2

package.json
{
"name": "opentok-react-native",
"version": "0.11.2",
"version": "0.12.0",
"description": "React Native components for OpenTok iOS and Android SDKs",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -6,9 +6,10 @@ import { Platform } from 'react-native';

const reassignEvents = (type, customEvents, events, publisherId) => {
const reassignEvents = (type, customEvents, events, eventKey) => {
const newEvents = {};
const preface = `${type}:`;
const platform = Platform.OS;
each(events, (eventHandler, eventType) => {
if (customEvents[platform][eventType] !== undefined && publisherId !== undefined) {
newEvents[`${publisherId}:${preface}${customEvents[platform][eventType]}`] = eventHandler;
if (customEvents[platform][eventType] !== undefined && eventKey !== undefined) {
newEvents[`${eventKey}:${preface}${customEvents[platform][eventType]}`] = eventHandler;
} else if(customEvents[platform][eventType] !== undefined ) {

@@ -22,2 +23,10 @@ newEvents[`${preface}${customEvents[platform][eventType]}`] = eventHandler;

});
// Set a default handler
each(customEvents[platform], (event) => {
if (eventKey !== undefined && !newEvents[`${eventKey}:${preface}${event}`]) {
newEvents[`${eventKey}:${preface}${event}`] = () => { };
}
});
return newEvents;

@@ -24,0 +33,0 @@ };

@@ -10,3 +10,3 @@ import { Platform } from 'react-native';

const sanitizeSessionEvents = (events) => {
const sanitizeSessionEvents = (sessionId, events) => {
if (typeof events !== 'object') {

@@ -47,3 +47,3 @@ return {};

};
return reassignEvents('session', customEvents, events);
return reassignEvents('session', customEvents, events, sessionId);
};

@@ -50,0 +50,0 @@

@@ -31,3 +31,3 @@ import React, { Component } from 'react';

OT.setJSComponentEvents(this.componentEventsArray);
this.sessionConnected = nativeEvents.addListener(this.componentEvents.sessionConnected, () => this.sessionConnectedHandler());
this.sessionConnected = nativeEvents.addListener(`${this.props.sessionId}:${this.componentEvents.sessionConnected}`, () => this.sessionConnectedHandler());
}

@@ -99,7 +99,9 @@ componentDidMount() {

} else {
OT.getSessionInfo((session) => {
if (!isNull(session) && isNull(this.state.publisher) && isConnected(session.connectionStatus)) {
this.publish();
}
});
if (this.props.sessionId) {
OT.getSessionInfo(this.props.sessionId, (session) => {
if (!isNull(session) && isNull(this.state.publisher) && isConnected(session.connectionStatus)) {
this.publish();
}
});
}
}

@@ -109,3 +111,3 @@ });

publish() {
OT.publish(this.state.publisherId, (publishError) => {
OT.publish(this.props.sessionId, this.state.publisherId, (publishError) => {
if (publishError) {

@@ -112,0 +114,0 @@ this.otrnEventHandler(publishError);

@@ -23,3 +23,3 @@ import React, { Component, Children, cloneElement } from 'react';

if (Object.keys(sanitizedCredentials).length === 3) {
const sessionEvents = sanitizeSessionEvents(this.props.eventHandlers);
const sessionEvents = sanitizeSessionEvents(sanitizedCredentials.sessionId, this.props.eventHandlers);
const sessionOptions = sanitizeSessionOptions(this.props.options);

@@ -53,8 +53,9 @@ setNativeEvents(sessionEvents);

const { signal } = this.props;
OT.initSession(credentials.apiKey, credentials.sessionId, sessionOptions);
OT.connect(credentials.token, (error) => {
const { apiKey, sessionId, token } = credentials;
OT.initSession(apiKey, sessionId, sessionOptions);
OT.connect(sessionId, token, (error) => {
if (error) {
this.otrnEventHandler(error);
} else {
OT.getSessionInfo((session) => {
OT.getSessionInfo(sessionId, (session) => {
if (!isNull(session)) {

@@ -65,3 +66,3 @@ const sessionInfo = { ...session, connectionStatus: getConnectionStatus(session.connectionStatus)};

});
logOT(credentials.apiKey, credentials.sessionId, 'rn_on_connect', session.connection.connectionId);
logOT(apiKey, sessionId, 'rn_on_connect', session.connection.connectionId);
if (Object.keys(signal).length > 0) {

@@ -76,7 +77,7 @@ this.signal(signal);

disconnectSession() {
OT.disconnectSession((disconnectError) => {
OT.disconnectSession(this.props.sessionId, (disconnectError) => {
if (disconnectError) {
this.otrnEventHandler(disconnectError);
} else {
const events = sanitizeSessionEvents(this.props.eventHandlers);
const events = sanitizeSessionEvents(this.props.sessionId, this.props.eventHandlers);
removeNativeEvents(events);

@@ -91,8 +92,6 @@ }

const signalData = sanitizeSignalData(signal);
OT.sendSignal(signalData.signal, signalData.errorHandler);
OT.sendSignal(this.props.sessionId, signalData.signal, signalData.errorHandler);
}
render() {
const { style } = this.props;
if (this.props.children) {

@@ -99,0 +98,0 @@ const childrenWithProps = Children.map(

@@ -25,5 +25,8 @@ import React, { Component } from 'react';

componentWillMount() {
this.streamCreated = nativeEvents.addListener(this.componentEvents.streamCreated, stream => this.streamCreatedHandler(stream));
this.streamDestroyed = nativeEvents.addListener(this.componentEvents.streamDestroyed, stream => this.streamDestroyedHandler(stream));
const subscriberEvents = sanitizeSubscriberEvents(this.props.eventHandlers);
const { sessionId, eventHandlers } = this.props;
this.streamCreated = nativeEvents.addListener(`${sessionId}:${this.componentEvents.streamCreated}`,
stream => this.streamCreatedHandler(stream));
this.streamDestroyed = nativeEvents.addListener(`${sessionId}:${this.componentEvents.streamDestroyed}`,
stream => this.streamDestroyedHandler(stream));
const subscriberEvents = sanitizeSubscriberEvents(eventHandlers);
OT.setJSComponentEvents(this.componentEventsArray);

@@ -58,12 +61,12 @@ setNativeEvents(subscriberEvents);

if (subscribeToSelf || (sessionInfoConnectionId !== stream.connectionId)){
OT.subscribeToStream(stream.streamId, subscriberProperties, (error) => {
if (error) {
this.otrnEventHandler(error);
} else {
this.setState({
streams: [...this.state.streams, stream.streamId],
});
}
});
OT.subscribeToStream(stream.streamId, subscriberProperties, (error) => {
if (error) {
this.otrnEventHandler(error);
} else {
this.setState({
streams: [...this.state.streams, stream.streamId],
});
}
});
}
}

@@ -70,0 +73,0 @@ streamDestroyedHandler = (stream) => {

@@ -12,3 +12,4 @@ import React, { Component } from 'react';

OTPublisherView.propTypes = {
publisherId: PropTypes.string.isRequired,
publisherId: PropTypes.string.isRequired,
sessionId: PropTypes.string.isRequired,
...viewPropTypes,

@@ -15,0 +16,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc