Skip to main content

Main API - Quanteec

For every React Native player, an API is available.

The API can be used to change the QUANTEEC plugin configuration while it is running or to access useful metrics linked to P2P and energy. The available methods are described on this page.

Player specification

Bitmovin

For the React Native version of the Bitmovin player, the API is directly integrate inside the player object itself. After the initialization of the QUANTEEC plugin, you will be able to use the player object to call the different API methods. Here is a simple example :

const player = usePlayer({
// The only required parameter is the license key but it can be omitted from code upon correct
// Info.plist/AndroidManifest.xml configuration.
//
// Head to `Configuring your License` for more information.
licenseKey: '<ENTER-YOUR-LICENSE-KEY>'
});

player.initQuanteec({
//Configuration du plugin Quanteec
quanteecKey:"<enter-your-custom-videoID>",
videoID:"<enter-your-custom-videoID>",
})

player.getPeerConnected();

Methods

activateP2P()

    activateP2P(activate: boolean);

To activate or deactivate the P2P inside the QUANTEEC plugin. This function totally deactivates all the exchanges between the viewers but not the connection with the controller, hence analytics will be retrieved.

Parameters:

NameTypeDescription
activate
Required
BooleanA boolean that indicates if the P2P inside the plugin must be activated or deactivated

activateQuanteec()

    activateQuanteec(activate: boolean);

To activate or deactivate the QUANTEEC plugin. This function totally deactivates p2p but also the connection to QUANTEEC controller servers, hence no analytics will be retrieved.

Parameters:

NameTypeDescription
activate
Required
BooleanA boolean that indicates if QUANTEEC plugin must be activated or deactivated

getDataCDN()

public getDataCDN(): number;

Returns the quantity of data downloaded from CDN in bytes.

getDataPeer()

public getDataPeer(): number;

Returns the quantity of data downloaded from P2P in bytes.

getDataSent()

public getDataSent(): number;

Returns the quantity of data sent to other peers in bytes.

getEnergySavedInCO2g()

    getEnergySavedInCO2g(): number;

To return the quantity of CO2 saved thanks to QUANTEEC, in grams (g), based on the quantity of energy saved.

getEnergySavedInLight()

    getEnergySavedInLight(): number;

To return the energy saved in lights switched off for 5 minutes.

getEnergySavedInWatercL()

    getEnergySavedInWatercL(): number;

To return the quantity of water saved thanks to QUANTEEC, in centiliters (cl), based on the quantity of energy saved.

getEnergySavedInWh()

    getEnergySavedInWh(): number;

To return the quantity of energy saved thanks to QUANTEEC, in Watt-hour (Wh).

getEnergySavedReceivedInWh()

    getEnergySavedReceivedInWh(): number;

To return the energy saved by the data received from other viewers thanks to QUANTEEC, in Watt-hour (Wh).

getEnergySavedSentInWh()

    getEnergySavedSentInWh(): number;

To return the energy saved by the data sent to other viewers thanks to QUANTEEC, in Watt-hour (Wh).

getGreenScore()

    getGreenScore(): number;

To return the "green score" computed thanks to QUANTEEC. It corresponds to the data sent and received in p2p divided by the received data in http.

getP2PPercent()

    public getP2PPercent(): float;

Returns the percentage of data received in P2P (from viewers) over the total received data (CDN+P2P).

getPeerConnected()

    public getPeerConnected(): int;

Returns the number of peers connected together through QUANTEEC.

setMaxUploadPercent()

    setMaxUploadPercent(percentage : number);

Function to set the maximum percentage of the upload bandwidth that can be used by the QUANTEEC plugin.

Parameters

NameTypeDescription
percentage
Required
NumberTo define the maximum percentage of upload bandwidth to use, between 0 and 1. At 0, the peer does not send anything but can receive data.