Skip to main content

Main API - QuanteecCore

public abstract class QuanteecCore

An abstract class that serves as the basis for creating QuanteecCore for Android players. The methods in this class can be used to change the QUANTEEC plugin configuration while it is running or to access useful metrics linked to P2P.

For each player, a class extending this QuanteecCore will be used to implement custom functionalities, depending on the player. For example, the class QuanteecExoCore extends this class and must be used to implement QUANTEEC inside ExoPlayer.

Summary

Public constructors

QuanteecCore(Context context, QuanteecConfig quanteecConfig)
warning

In your QUANTEEC configuration, remember to set a different videoID if you have different formats of the same stream (e.g., one DASH stream and one HLS stream) or two variants of the same stream (one stream with English audio and one stream with another language).

Click here to find more informations on videoID

Public methods

final voidactivateP2P(boolean activated)
final voidactivateQuanteec(boolean activated)
longgetDataCDN()
longgetDataPeer()
longgetDataSent()
doublegetEnergySavedInCO2g()
doublegetEnergySavedInLight()
doublegetEnergySavedInWatercL()
doublegetEnergySavedInWh()
floatgetP2PPercent()
intgetPeerConnected()
doublegetEnergySavedReceivedInWh()
doublegetEnergySavedSentInWh()
doublegetGreenScore()
final voidregisterAnalyticsListener(AnalyticsListener listener)
final voidsetMaxUploadPercent(double value)

Public methods - Android specific

RequestResultload(Uri uri)
RequestResultload(Uri uri,OutputStream progressOutputStream)

Public constructors

QuanteecCore()

public QuanteecCore(Context context, QuanteecConfig config)

Parameters

NameTypeDescription
contextContextA context
quanteecConfigQuanteecConfigA QUANTEEC configuration object describing the initial configuration of the core

Public methods

activateP2P()

public void activateP2P(boolean activated)

Activate or deactivate the P2P inside the QUANTEEC plugin. This function totally deactivates all the exchanges between the viewers.

Parameters:

NameTypeDescription
activatedBooleanA boolean that indicates if the P2P inside the plugin must be activated or deactivated

activateQuanteec()

public void activateQuanteec(boolean activated)

Activate or deactivate the QUANTEEC plugin. This function totally deactivates p2p but also the connection to QUANTEEC controller server.

Parameters:

NameTypeDescription
activatedBooleanA boolean that indicates if QUANTEEC plugin must be activated or deactivated

getDataCDN()

public long getDataCDN()

Returns the quantity of data downloaded from CDN in bytes.

getDataPeer()

public long getDataPeer()

Returns the quantity of data downloaded from P2P in bytes.

getDataSent()

public long getDataSent()

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

getEnergySavedInCO2g()

    public double getEnergySavedInCO2g();

Returns the quantity of CO2 saved in grams (g) based on the quantity of energy saved.

getEnergySavedInLight()

    public double getEnergySavedInLight();

Returns the energy saved in number of 30-watts light bulbs switched off during 5 minutes.

getEnergySavedInWatercL()

    public double getEnergySavedInWatercL();

Returns the quantity of water saved in centiliters (cl) based on the quantity of energy saved.

getEnergySavedInWh()

    public double getEnergySavedInWh();

Returns the quantity of energy saved in Watt-hours (Wh).

getEnergySavedReceivedInWh()

    public double getEnergySavedReceivedInWh();

Returns the energy saved by the data received, in Watt-hours (Wh).

getEnergySavedSentInWh()

    public double getEnergySavedSentInWh();

Returns the energy saved by the data sent, in Watt-hours (Wh).

getGreenScore()

    public double getGreenScore();

Returns the greenScore computed: the data sent and received in P2P (to/from viewers) divided by the received data in http (from CDN).

getP2PPercent()

    public float getP2PPercent();

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

getPeerConnected()

    public int getPeerConnected();

Returns the number of peers connected together through QUANTEEC.

registerAnalyticsListener()

public void registerAnalyticsListener(AnalyticsListener listener)

Registers an AnalyticsListener instance in the QuanteecCore. An AnalyticsListener can be used to get the analytics gathered by the QuanteecCore.

Parameters:

NameTypeDescription
listenerAnalyticsListenerRegister an AnalyticsListener in the QuanteecCore

setMaxUploadPercent()

public void setMaxUploadPercent(double value)

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

Parameters

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

Public methods - Android specific

load(Uri)

    public RequestResult load(Uri uri);

Opens the URL to download the specified data through QUANTEEC. This function will download all the data before sending it back.

Parameters:

NameTypeDescription
uriUriThe Uri of the data that must be downloaded

load(Uri, OutputStream)

    public RequestResult load(Uri uri, OutputStream progressOutputStream);

Opens the URL to download the specified data through QUANTEEC. This function will end the data through the progressOutputStream while downloading them. This behavior is useful with a low-latency stream to send data to the buffer without downloading the entire segment.

Parameters:

NameTypeDescription
uriUriThe Uri of the data that must be downloaded
progressOutputStreamOutputStreamAn OutputStream in which the data will be sent while downloading them