furioos-sdk v2.0.3
Furioos SDK JS
:warning: if you are using the first version of the SDK, please refer to this documentation: Furioos SDK V1
Requirements
- A Furioos Account on www.furioos.com.
- Then choose the application you want to use with the SDK and create a SDK link.
Table of contents
About Furioos SDK
The Furioos SDK is composed of 2 parts:
- one is on the website side
- and the other one is on the application side
On the website side you have to use the Furioos SDK JS. It allows you to :
- embed the Furioos player into your website and customize it
- communicate with your Unity or Unreal application
Why cutomize your Furioos player
Here are some possible use cases for player customization (it's not an exhaustive list):
- remove all Furioos branding
- hide the play button
- hide the player toolbar and build a new one from your website
- create your own installation progress bar
- trigger your own features once the stream has been started
- ...
*Note: For these examples you just need to have the Furioos SDK JS in your website.*
Communication inbetween my website and my application
However, if you need to communication inbetween your website and your Unity or Unreal application, you will need to add the Furioos SDK (Unity or Unreal) into your application. This allows you to send and receive bidirectional messages.
*Important: Before sending or receiving messages, the session must be launched. You can check it with ON_APP_START event*
Here are some examples:
- If you want to change the color of an object from your website, you can:
- Send a message with the final color from your website
- From your application, get the color in the message and assign the material with the new color
- If you want to get the position of the player to display it on your website
- Send a message with player coord from the application
- From your website, get the coordinates and show it on your website
To implement a bidirectionnal communication you can find details below:
- About Furioos SDK for Unity
- About Furioos SDK for Unreal
Example of application
Here is an example of an application that customizes the Furioos player and uses the message system for a complete integration with the website.\ On the left, the menu is on the website side (html).\ On the right, the house dispay is on the application side (Furious player).
Installation
Via NPM
npm install --save furioos-sdk
or
yarn add furioos-sdk
You can find a full example HERE
Via CDN
<script src="https://cdn.jsdelivr.net/npm/furioos-sdk@2.0.3/dist/furioos.bundle.js"></script>
You can find a full example HERE
API
constructor(sdkShareLinkID, containerDivId, options)
Instanciate the player for a given application.
| Property | Type | Description | optional | DefaultValue |
| --- | --- | --- | --- | --- |
| sdkShareLinkID
| String | Furioos SDK Link ID of the application you want to share. | false | null |
| containerDivId
| String | The ID of the HTML container div that will host the render. | false | null |
| options
| Object | The options to setup the player are these following : | true | {} |
options:
Property | Type | Description | optional | DefaultValue |
---|---|---|---|---|
whiteLabel | Boolean | Remove all Furioos' Logo | true | false |
hideToolbar | Boolean | Hide the toolbar to create your own | true | false |
hideTitle | Boolean | Hide the title bar to create your own | true | false |
hidePlayButton | Boolean | Hide the play button | true | false |
debugAppMode | Boolean | Active local debug of your application. See Debug localy the SDK communication tunnel for more detail | true | false |
inactiveTimeout | Number | Defines the inactivity time in a session before it closes (in ms) Min: 10s / Max: 24h | true | 60000 (ms) |
Basic Example
import { Player, FS_SDK_EVENTS_NAME } from 'furioos-sdk';
const options = {
whiteLabel: true,
hideToolbar: false,
hideTitle: true,
hidePlayButton: false,
inactiveTimeout: 60000,
};
const player = new Player("YOUR_SDK_LINK_ID" ,"containerDivId", options);
// Bind player loaded
player.on(FS_SDK_EVENTS_NAME.LOAD, function() {
console.log("SDK client FIRED: Player loaded");
});
// Bind application install progress
player.on(FS_SDK_EVENTS_NAME.ON_APP_INSTALL_PROGRESS, function(data) {
console.log("SDK client FIRED: App install progress", data);
});
// Bind application start
player.on(FS_SDK_EVENTS_NAME.ON_APP_START, function() {
console.log("SDK client FIRED: App start");
});
// Bind stream start
player.on(FS_SDK_EVENTS_NAME.ON_STREAM_START, function() {
console.log("SDK client FIRED: Stream start");
});
// Bind stream start
player.on(FS_SDK_EVENTS_NAME.ON_SDK_START, function() {
console.log("SDK client FIRED: SDK start");
});
// Bind SDK messages
player.on(FS_SDK_EVENTS_NAME.ON_SDK_MESSAGE, function(data) {
console.log("SDK Message Received:", data);
});
// Bind an event that lets you know if you can resume session
player.on(FS_SDK_EVENTS_NAME.ON_RESUME_SESSION, function({ canResumeSession }) {
if(canResumeSession) {
player.resumeSession();
}
});
// Bind session stoppeds
player.on(FS_SDK_EVENTS_NAME.ON_SESSION_STOPPED, function() {
console.log("SDK client FIRED: Session Stopped");
});
Properties
*important These properties are only getters*
quality: String
Get the current setted quality. Possible values : AUTO / LOW / MEDIUM / HIGH
volume: Number
Get the current setted volume. Value between 0 - 1
Methods
player.getServerAvailability(function(data) {
console.log("Time to assign a server: ", data.assignTime);
console.log("Time to copy, extract and launch your application: ", data.launchTime);
console.log("Number of machines ready for a session: ", data.availableMachines);
console.log("Total time to get session ready: ", data.assignTime + data.launchTime);
}, function(error) {
// Treat the error.
});
stop()
Stop the session.
maximize()
Enable Full screen mode.
minimize()
Disable Full screen mode.
restartStream()
Restart the streaming.
resumeSession()
Resume active session. You can only call this method after check the response value of ON_RESUME_SESSION event
toggleMuted()
Mute the stream. You can call this method before the application is launched with the ON_APP_INSTALL_SUCCESS event.
setUserActive()
This function helps you to keep the session opened if your user does not interact with the interface.
Calling this function will fire onUserActive.
:warning: *important: We recommended to use inactiveTimeout in Player constructor instead of calling this function. If you always call it without checking if the user is really here the session will never end untill the user close their window.*
Events
.on(FS_SDK_EVENTS_NAME, callback)
To be able to bind player events, you just need to call the .on function and give it an SDK events parameter and a callback to get the infos. All FS_SDK_EVENTS_NAME constants are accessible from the furioos-sdk package.
Example
player.on(FS_SDK_EVENTS_NAME.LOAD, function(data) {
// Here you know when the player is ready.
console.log("SDK client FIRED: Player loaded");
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_APP_INSTALL_PROGRESS, function(data) {
// Implement your own code.
console.log(data.status + " the application : " + Math.round(data.progress*100) + "%");
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_USER_ACTIVE, function() {
// Implement your own code.
console.log("My user is active");
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_USER_INACTIVE, function() {
// Implement your own code.
console.log("My user is inactive");
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_SESSION_STOPPED, function() {
// Implement your own code.
console.log("The session has been stopped");
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_STATS, function(stats) {
// Implement your own code.
console.log("Stats received: ", stats);
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_SDK_MESSAGE, function(data) {
// Implement your own code.
console.log("The application sent: " + data);
})
Example
player.on(FS_SDK_EVENTS_NAME.ON_CRASH_APP, function() {
// Implement your own code.
console.log("The application crashed");
})
data:
| Property | Type | Description | Value |
| --- | --- | --- | --- |
| canResumeSession
| Boolean | Define if you can resume a session or not | |
Example
player.on(FS_SDK_EVENTS_NAME.ON_RESUME_SESSION, function(data) {
// Implement your own code.
if(data.canResumeSession) {
player.resumeSession();
}
console.log("Can resume sesssion: " + data.canResumeSession);
})
Communicate with your application
Go deeper with your UI by creating your own data interpretation.
Those methods let you send/receive JSON data inbetween your application and the HTML page where you have implemented the JS SDK.
Requirements
- The Furioos SDK implemented in your application.
- Furioos SDK for Unity : https://github.com/Unity-Technologies/furioos-sdk-unity
- Furioos SDK for Unreal : https://github.com/Unity-Technologies/furioos-sdk-unreal-engine
Examples of implementation
Debug localy the SDK communication tunnel
The Furioos SDK Unity provides a local debug mode, to facilitate the debugging of sending and receiving messages.
*Note: There will be no stream.*
This feature opens a direct tunnel inbetween your website and your application running locally.\ Only sendSDKMessage and onSDKMessage can be used here to test the communication.
How does it work ?
Webclient Side
To enable debugging mode you have to set the debugAppMode property to true.
import { Player } from 'furioos-sdk';
const options = {
whiteLabel: true,
hideToolbar: false,
hideTitle: true,
hidePlayButton: false,
debugAppMode: true, // This enable the local debug mode.
};
const player = new Player("YOUR_SDK_LINK_ID", "containerDivId", options);
When you launch your site in debug mode, the stream is not displayed, the following message will appear on your player.
Unity Side
Nothing to configure. When you start your application(With last version of the Furioos SDK Unity) with the play button in the Unity Editor, the local debug mode is automatically enabled.
Unreal Engine Side
For the moment, it is not possible activate the debug mode. The new version of the Furioos SDK for Unreal is coming soon.
:warning: Common Errors
Failed to execute 'postMessage' on 'DOMWindow': The target origin (http://....) provided does not match the recipient window's origin ('http://...')
This error means that you do not have the correct website URL set on your SDK link, on Furioos side.
Your player’s implementation url must match the website URL entered when creating your SDK link on the Furioos side. If you’re working locally, remind that you might need to change the URL on the SDK Link, example: http://localhost:8080.
2 years ago
2 years ago
2 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago