LiveStreamingModule
The LiveStreamingModule class enables to retrieve information from a live stream from within the effect, such as reactions and comments.
Example
//==============================================================================
// The following example demonstrates how to dynamically update an effect based
// on the reactions and comments of a viewer during a livestream.
//
// Project setup:
// - Insert two text objects
//==============================================================================
// Load in the required modules
const LiveStreaming = require('LiveStreaming');
const Scene = require('Scene');
// Locate the text objects in the Scene
const angryCountText = Scene.root.find('text0');
const matchCounterText = Scene.root.find('text1');
// Store references to the reactions and comments properties
const reactions = LiveStreaming.reactions;
const comments = LiveStreaming.comments;
//==============================================================================
// Displaying a number based on the number of a certain reaction from viewers
//==============================================================================
// Store a reference to the number of angry reactions
const angryCount = reactions.angry;
// Bind the number of angry reactions to the text object
angryCountText.text = angryCount.toString();
//==============================================================================
// Displaying a string based on the number of comments from viewers
//==============================================================================
// Define what strings we want to start a counter for
const matchStrings = ['cat','dog'];
// Define if those strings should be case sensitive or not
const isCaseSensitive = false;
// Create a variable to store the highest count
var leadingCount = 0;
// Subscribe to the startMatchCounter EventSource
comments.startMatchCounter(matchStrings,isCaseSensitive).subscribe(
function(result) {
// Loop through the keys in the result (e.g. 'cat' or 'dog')
for (var key in result) {
// Update the text and leadingCount if the count of the result is
// is greater than the current leadingCount
if (result[key] > leadingCount) {
matchCounterText.text = key;
leadingCount = result[key];
}
}
});Properties
| Property | Description |
|---|---|
|
Provides access to a |
|
Provides access to a |
|
Provides access to a |
|
Specifies a |
Methods
This module exposes no methods.
Classes
| Class | Description |
|---|---|
The | |
The |
Enums
| Enum | Description |
|---|---|
The |