opentok-accelerator-core
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -158,3 +158,4 @@ 'use strict'; | ||
screenProperties = options.screenProperties, | ||
autoSubscribe = options.autoSubscribe; | ||
autoSubscribe = options.autoSubscribe, | ||
subscribeOnly = options.subscribeOnly; | ||
@@ -169,2 +170,3 @@ _this.active = false; | ||
_this.autoSubscribe = options.hasOwnProperty('autoSubscribe') ? autoSubscribe : true; | ||
_this.subscribeOnly = options.hasOwnProperty('subscribeOnly') ? subscribeOnly : false; | ||
_this.screenProperties = Object.assign({}, defaultCallProperties, { videoSource: 'window' }, screenProperties); | ||
@@ -224,4 +226,14 @@ } | ||
session = _this.session, | ||
triggerEvent = _this.triggerEvent; | ||
triggerEvent = _this.triggerEvent, | ||
subscribeOnly = _this.subscribeOnly; | ||
/** | ||
* For subscriber tokens or cases where we just don't want to be seen or heard. | ||
*/ | ||
if (subscribeOnly) { | ||
message('Instance is configured with subscribeOnly set to true. Cannot publish to session'); | ||
return Promise.resolve(); | ||
} | ||
return new Promise(function (resolve, reject) { | ||
@@ -228,0 +240,0 @@ var onPublish = function onPublish(publisher) { |
@@ -46,3 +46,3 @@ 'use strict'; | ||
var otkanalyticsData = { | ||
clientVersion: 'js-vsol-2.0.9', // x.y.z filled by npm build script | ||
clientVersion: 'js-vsol-2.0.10', // x.y.z filled by npm build script | ||
source: source, | ||
@@ -49,0 +49,0 @@ componentId: 'acceleratorCore', |
{ | ||
"name": "opentok-accelerator-core", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "Opentok Accelerator Core", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/opentok/accelerator-core-js", |
@@ -33,3 +33,3 @@ ![logo](./tokbox-logo.png) | ||
There are two sample applications for `Core` . The [React](https://github.com/opentok/accelerator-core-js/tree/master/react-sample-app) sample application was built with [Create React App](https://github.com/facebookincubator/create-react-app) and uses [webpack](https://webpack.github.io/) to transpile code. The other [sample application](https://github.com/opentok/accelerator-core-js/tree/master/vanilla-js-sample-app) is built with vanilla JavaScript. | ||
There are two sample applications for `Core` . The [React](https://github.com/opentok/accelerator-core-js/tree/master/react-sample-app) sample application was built with [Create React App](https://github.com/facebookincubator/create-react-app) and uses [webpack](https://webpack.github.io/) to transpile code. The other [sample application](https://github.com/opentok/accelerator-sample-apps-js/tree/master/vanilla-js-sample-app) is built with vanilla JavaScript. | ||
@@ -75,6 +75,6 @@ ## Installation | ||
/** | ||
* @param {String} pubSub - 'publisher' or 'subscriber' | ||
* @param {String} type - 'camera' or 'screen' | ||
* @param {*} data - Parsed stream connection data (subscriber only) | ||
* @param {Object} stream - The new stream (subscriber only) | ||
* @param {String} pubSub - 'publisher' or 'subscriber' | ||
* @param {String} type - 'camera' or 'screen' | ||
* @param {*} data - Parsed stream connection data (subscriber only) | ||
* @param {Object} stream - The new stream (subscriber only) | ||
*/ | ||
@@ -96,7 +96,13 @@ streamContainers(pubSub, type, data, stream){ | ||
#### Communication Options | ||
The `communication` properties relate to the multi-party communication provided by `Core`. `autoSubscribe` dictates whether or not `Core` automatically subscribes to new streams and is set to `true` by default. `connectionLimit` limits the number of parties that may publish/subscribe to the session. `callProperties` allows for [customization](https://www.tokbox.com/developer/guides/customize-ui/js/) of the UI. | ||
The `communication` properties relate to the multi-party communication provided by `Core`: | ||
* `autoSubscribe` dictates whether or not `Core` automatically subscribes to new streams and is set to `true` by default. | ||
* `subscribeOnly`, which is set to `false` by default, allows users to join an OpenTok session and subscribe to streams without publishing any audio or video. | ||
* `connectionLimit` limits the number of parties that may publish/subscribe to the session. | ||
* `callProperties` allows for [customization](https://www.tokbox.com/developer/guides/customize-ui/js/) of the UI. | ||
```javascript | ||
communication: { | ||
autoSubscribe: true, | ||
subscribeOnly: false, | ||
connectionLimit: null, | ||
@@ -103,0 +109,0 @@ callProperties: myCallProperties, |
@@ -32,2 +32,2 @@ # OpenTok Accelerator Sample App for JavaScript React | ||
*Looking for a sample in plain JavaScript? Click [here](https://github.com/opentok/accelerator-core-js/tree/master/vanilla-js-sample-app).* | ||
*Looking for a sample in plain JavaScript? Click [here](https://github.com/opentok/accelerator-sample-apps-js/tree/master/vanilla-js-sample-app).* |
@@ -35,3 +35,3 @@ /* global OT */ | ||
}); | ||
const { callProperties, screenProperties, autoSubscribe } = options; | ||
const { callProperties, screenProperties, autoSubscribe, subscribeOnly } = options; | ||
this.active = false; | ||
@@ -45,2 +45,3 @@ this.core = options.core; | ||
this.autoSubscribe = options.hasOwnProperty('autoSubscribe') ? autoSubscribe : true; | ||
this.subscribeOnly = options.hasOwnProperty('subscribeOnly') ? subscribeOnly : false; | ||
this.screenProperties = Object.assign({}, defaultCallProperties, { videoSource: 'window' }, screenProperties); | ||
@@ -95,3 +96,12 @@ } | ||
publish = (publisherProperties) => { | ||
const { analytics, state, createPublisher, session, triggerEvent } = this; | ||
const { analytics, state, createPublisher, session, triggerEvent, subscribeOnly } = this; | ||
/** | ||
* For subscriber tokens or cases where we just don't want to be seen or heard. | ||
*/ | ||
if (subscribeOnly) { | ||
message('Instance is configured with subscribeOnly set to true. Cannot publish to session'); | ||
return Promise.resolve(); | ||
} | ||
return new Promise((resolve, reject) => { | ||
@@ -98,0 +108,0 @@ const onPublish = publisher => (error) => { |
Sorry, the diff of this file is too big to display
637860
14818
263