opentok-react-native
Advanced tools
Comparing version 0.10.3 to 0.11.0
@@ -10,2 +10,3 @@ ### OTSubscriber Component | ||
| eventHandlers | Object<Function> | No | Event handlers passed into the native subscriber instance | ||
| subscribeToSelf | Boolean | No | If true, subscribe to his own stream (default: false) | ||
@@ -12,0 +13,0 @@ ## Properties |
{ | ||
"name": "opentok-react-native", | ||
"version": "0.10.3", | ||
"version": "0.11.0", | ||
"description": "React Native components for OpenTok iOS and Android SDKs", | ||
@@ -28,3 +28,3 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"axios": "^0.18.0", | ||
"axios": "^0.19.0", | ||
"prop-types": "^15.6.0", | ||
@@ -31,0 +31,0 @@ "underscore": "^1.8.3", |
@@ -100,2 +100,3 @@ import React, { Component, Children, cloneElement } from 'react'; | ||
sessionId: this.props.sessionId, | ||
sessionInfo: this.state.sessionInfo | ||
}, | ||
@@ -102,0 +103,0 @@ ) : child), |
@@ -15,2 +15,3 @@ import React, { Component } from 'react'; | ||
streams: [], | ||
subscribeToSelf: props.subscribeToSelf || false | ||
}; | ||
@@ -50,14 +51,19 @@ this.componentEvents = { | ||
streamCreatedHandler = (stream) => { | ||
const { streamProperties, properties } = this.props; | ||
const { subscribeToSelf } = this.state; | ||
const { streamProperties, properties, sessionInfo } = this.props; | ||
const subscriberProperties = isNull(streamProperties[stream.streamId]) ? | ||
sanitizeProperties(properties) : sanitizeProperties(streamProperties[stream.streamId]); | ||
OT.subscribeToStream(stream.streamId, subscriberProperties, (error) => { | ||
if (error) { | ||
this.otrnEventHandler(error); | ||
} else { | ||
this.setState({ | ||
streams: [...this.state.streams, stream.streamId], | ||
}); | ||
} | ||
}); | ||
// Subscribe to streams. If subscribeToSelf is true, subscribe also to his own stream | ||
const sessionInfoConnectionId = sessionInfo && sessionInfo.connection ? sessionInfo.connection.connectionId : null; | ||
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], | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -96,2 +102,4 @@ streamDestroyedHandler = (stream) => { | ||
containerStyle: PropTypes.object, // eslint-disable-line react/forbid-prop-types | ||
sessionInfo: PropTypes.object, // eslint-disable-line react/forbid-prop-types | ||
subscribeToSelf: PropTypes.bool | ||
}; | ||
@@ -104,2 +112,4 @@ | ||
containerStyle: {}, | ||
sessionInfo: {}, | ||
subscribeToSelf: false | ||
}; |
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
223056
818
+ Addedaxios@0.19.2(transitive)
- Removedaxios@0.18.1(transitive)
- Removedis-buffer@2.0.5(transitive)
Updatedaxios@^0.19.0