Main API - QuanteecPlugin
The QUANTEEC plugin for AVPlayer is currently in a beta state. This documentation might change in the future, according to our development.
public class QuanteecPlugin
A class that serves as the basis for creating a QuanteecPlugin for AVplayers. 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.
Summary
Public constructors
QuanteecPlugin(clientID: String) |
Public attributes - iOS specific
AVPlayer | player |
Public methods
Void | activateP2P(activated: Bool) |
Void | activateQuanteec(activated: Bool) |
Double | getEnergySavedInCO2g() |
Double | getEnergySavedInLight() |
Double | getEnergySavedInWatercL() |
Double | getEnergySavedInWh() |
Double | getEnergySavedReceivedInWh() |
Double | getEnergySavedSentInWh() |
Double | getGreenScore() |
Void | setMaxUploadPercent(value: Double) |
Public methods - iOS specific
Int | getDataCDN() |
Int | getDataPeer() |
Int | getDataSent() |
Float | getP2PPercent() |
Int | getPeerConnected() |
Void | replaceCurrentItem(with: String, VideoID: String) |
Public constructors
QuanteecPlugin()
public QuanteecPlugin(clientID: String)
Parameters
Name | Type | Description |
---|---|---|
clientID | String | Your personal QUANTEEC key used to authenticate the plugin. |
Public attributes - iOS specific
player
player AVPlayer
The AVPlayer instance embedded inside the QUANTEEC plugin that will be used to read media.
Public methods
activateP2P()
public func activateP2P(activated: Bool )
Activate or deactivate the P2P inside the QUANTEEC plugin. This function totally deactivates all the exchanges between the viewers.
Parameters:
Name | Type | Description |
---|---|---|
activated | Bool | A boolean which indicates if the P2P inside the plugin must be activated or deactivated |
activateQuanteec()
public func activateQuanteec(activated: Bool)
Activate or deactivate the QUANTEEC plugin. This function totally deactivates p2p but also the connection to QUANTEEC controller server.
Parameters:
Name | Type | Description |
---|---|---|
activated | Bool | A boolean which indicates if QUANTEEC plugin must be activated or deactivated |
getEnergySavedInCO2g()
public func getEnergySavedInCO2g() -> Double;
Returns the quantity of CO2 saved in grams (g) based on the quantity of energy saved.
getEnergySavedInLight()
public func getEnergySavedInLight() -> Double;
Returns the energy saved in number of 30-watts lights bulbs switched off during 5 minutes.
getEnergySavedInWatercL()
public func getEnergySavedInWatercL() -> Double;
Returns the quantity of water saved in centiliters (cl) based on the quantity of energy saved.
getEnergySavedInWh()
public func getEnergySavedInWh() -> Double;
Returns the quantity of energy saved in Watt-hours (Wh).
getEnergySavedReceivedInWh()
public func getEnergySavedReceivedInWh() -> Double;
Returns the energy saved by the data received, in Watt-hours (Wh).
getEnergySavedSentInWh()
public func getEnergySavedSentInWh() -> Double;
Returns the energy saved by the data sent, in Watt-hours (Wh).
getGreenScore()
public func getGreenScore() -> Double;
Returns the greenScore computed: the data sent and received in P2P (to/from viewers) divided by the received data in http (from CDN).
setMaxUploadPercent()
public func setMaxUploadPercent(value: Double);
Function to set the maximum percentage of the upload bandwidth that can be used by the QUANTEEC plugin.
Parameters
Name | Type | Description |
---|---|---|
percentage | Double | Defines 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 - AVPlayer specific
getDataCDN()
public func getDataCDN()-> Int;
Returns the quantity of data downloaded from CDN in MB
getDataPeer()
public func getDataPeer()-> Int;
Returns the quantity of data downloaded from P2P in MB
getDataSent()
public func getDataSent()-> Int;
Returns the quantity of data sent to other peers in MB
getP2PPercent()
public func getP2PPercent()-> Float;
Returns the percentage of data received in P2P (from viewers) over the total received data (CDN+P2P).
getPeerConnected()
public func getPeerConnected()-> Int;
Returns the number of peers connected together through QUANTEEC.
replaceCurrentItem()
public func replaceCurrentItem(with: String, videoID: String);
Function to set or replace the current media read by AVPlayer and setting a new videoID
Parameters
Name | Type | Description |
---|---|---|
with | String | The URL of the new media that will be read by AVPLayer. |
videoID | String | The videoID link to the new media that will be read by AVPLayer. |