opentok-react-native
Advanced tools
Comparing version 0.18.0 to 0.19.0
@@ -0,1 +1,7 @@ | ||
# 0.19.0 (Oct 11, 2021) | ||
- [Update]: update SDKs Android to 2.20.2 | ||
- [Update]: added IceConfig options in the Session Options object | ||
- [Fix]: added missing typings in @types/index.d.ts | ||
- [Fix]: fix crash in OTSubscriberLayout [#525](https://github.com/opentok/opentok-react-native/pull/525) | ||
# 0.18.0 (Jun 24, 2021) | ||
@@ -2,0 +8,0 @@ - [Update]: update SDKs iOS to 2.20.0 and Android to 2.20.1 |
@@ -87,5 +87,6 @@ ### OTSession Component | ||
### Setting Session options: | ||
### Setting Session options: | ||
You can set the session options using the `options` prop. Please note that all session options are optional: | ||
```javascript | ||
@@ -103,2 +104,16 @@ class App extends Component { | ||
enableStereoOutput: true // Enable stereo output, default is false | ||
iceConfig:{ | ||
transportPolicy: 'all', // Valid options are 'all' or 'relay'. Default is 'all' | ||
includeServers: 'all', // Valid options are 'all' or 'custom'. Default is 'all' | ||
customServers: [ | ||
{ | ||
urls: [ | ||
'turn:123.124.125.126:3478?transport=udp', | ||
'turn:123.124.125.126:3478?transport=tcp' | ||
], | ||
username: 'webrtc', | ||
credential: 'foO0Bar1' | ||
}, | ||
], | ||
}, | ||
}; | ||
@@ -116,2 +131,13 @@ } | ||
} | ||
``` | ||
``` | ||
#### Configurable Turn Servers | ||
You can customize TURN server usage for each client in the session in the following ways: | ||
- You can add a list of your own TURN servers that the client will use. | ||
- You can decide whether the client should use your TURN servers exclusively or use them in addition to the OpenTok TURN servers | ||
This feature is available as an [add-on feature](https://tokbox.com/pricing/plans). | ||
Please see [https://tokbox.com/developer/guides/configurable-turn-servers/](https://tokbox.com/developer/guides/configurable-turn-servers/) for a detailed documentation. | ||
{ | ||
"name": "opentok-react-native", | ||
"version": "0.18.0", | ||
"version": "0.19.0", | ||
"description": "React Native components for OpenTok iOS and Android SDKs", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -11,2 +11,3 @@ import { Platform } from 'react-native'; | ||
isObject, | ||
isArray | ||
} from 'underscore'; | ||
@@ -20,2 +21,4 @@ | ||
const validateArray = (value) => (isArray(value) ? value : []); | ||
const sanitizeSessionEvents = (sessionId, events) => { | ||
@@ -39,3 +42,3 @@ if (typeof events !== 'object') { | ||
archiveStopped: 'archiveStoppedWithId', | ||
streamPropertyChanged: 'streamPropertyChanged', | ||
streamPropertyChanged: 'streamPropertyChanged' | ||
}, | ||
@@ -55,4 +58,4 @@ android: { | ||
archiveStopped: 'onArchiveStopped', | ||
streamPropertyChanged: 'onStreamPropertyChanged', | ||
}, | ||
streamPropertyChanged: 'onStreamPropertyChanged' | ||
} | ||
}; | ||
@@ -62,2 +65,34 @@ return reassignEvents('session', customEvents, events, sessionId); | ||
const sanitizeCustomTurnOptions = (options) => { | ||
let sessionOptions = {}; | ||
if (typeof options !== 'object') { | ||
return {}; | ||
} | ||
const validCustomTurnOptions = { | ||
includeServers: 'string', | ||
transportPolicy: 'string', | ||
customServers: 'Array' | ||
}; | ||
const customTurnOptions = { | ||
includeServers: 'all', | ||
transportPolicy: 'all', | ||
customServers: [] | ||
}; | ||
each(options, (value, key) => { | ||
const optionType = validCustomTurnOptions[key]; | ||
if (optionType !== undefined) { | ||
if (optionType === 'string') { | ||
sessionOptions[key] = validateString(value); | ||
} else if (optionType === 'Array') { | ||
sessionOptions[key] = validateArray(value); | ||
} | ||
} else { | ||
handleError(`${key} is not a valid option`); | ||
} | ||
}); | ||
return sessionOptions; | ||
}; | ||
const sanitizeSessionOptions = (options) => { | ||
@@ -129,2 +164,10 @@ const platform = Platform.OS; | ||
if (sessionOptions.iceConfig) { | ||
const customTurnOptions = sanitizeCustomTurnOptions( | ||
sessionOptions.iceConfig | ||
); | ||
each(customTurnOptions, (value, key) => { | ||
sessionOptions[key] = customTurnOptions[key]; | ||
}); | ||
} | ||
return sessionOptions; | ||
@@ -139,5 +182,5 @@ }; | ||
data: '', | ||
to: '', | ||
to: '' | ||
}, | ||
errorHandler: handleSignalError, | ||
errorHandler: handleSignalError | ||
}; | ||
@@ -149,3 +192,3 @@ } | ||
data: validateString(signal.data), | ||
to: validateString(signal.to), | ||
to: validateString(signal.to) | ||
}, | ||
@@ -197,3 +240,3 @@ errorHandler: | ||
getConnectionStatus, | ||
isConnected, | ||
isConnected | ||
}; |
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
316786
74
1412