Skip to main content

Main API - Quanteec

For every player, calling new Quanteec(quanteecConfig, player) returns a javascript object with an API.

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.

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()

    getDataCDN(): number;

To return the total quantity of data received from the CDN in HTTP (in bytes)

getDataPeer()

    getDataPeer(): number;

To return the total quantity of data received from other peers (in bytes)

getDataSent()

    getDataSent(): number;

To return the total 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.

getPeerConnected()

    getPeerConnected(): number;

To return the number of peers the plugin is connected with.

reset()

    reset();

Clean all of the connections and memory buffers used by 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.