This article explains how to use Streamroot's Statistics API.
Streamroot instances are always exposed on the global namespace.
You can obtain the number of instances with the following window.Streamroot.instances.length
.
But in general, when you have only one instance on your page, you can access the data using window.Streamroot.instances[0]
.
Example
When calling :
window.Streamroot.instances[0]
It returns :
{
dnaDownloadAllowed: true,
dnaDownloadEnabled: true, // Deprecated from DNA 2.4
dnaDownloadOnCellularAllowed: null,
dnaDownloadOnWifiEthernetAllowed: null,
dnaUploadAllowed: true,
dnaUploadEnabled: true, // Deprecated from DNA 2.4
dnaUploadOnCellularAllowed: null,
dnaUploadOnWifiEthernetAllowed: null,
id: "123e4567-e89b-12d3-a456-426655440000",
stats: {
allContents: {
cdnDownload: 23641258,
dnaDownload: 45619783,
dnaUpload: 36449517
},
currentContent: {
cdnDownload: 23641258,
dnaDownload: 45619783,
dnaUpload: 36449517
},
realtime: {
dnaSources: 8,
},
},
transferStatus: {
effectiveDownloadAllowed: true,
effectiveUploadAllowed: true,
},
versions: {
peerAgent:"5.4.2",
streamrooter:"0.14.1",
wrapper:"1.0.30"
}
}
API table
NAME | DESCRIPTION |
---|---|
dnaDownloadEnabled |
Getter/Setter to switch peer download ON or OFF. |
dnaUploadEnabled |
Getter/Setter to switch peer upload ON or OFF. |
dnaDownloadAllowed* |
Getter/Setter to allow or not peer download, regardless of the network type**. |
dnaDownloadOnCellularAllowed* |
Getter/Setter to allow or not peer download. |
dnaDownloadOnWifiEthernetAllowed* |
Getter/Setter to allow or not peer download. |
dnaUploadAllowed* |
Getter/Setter to allow or not peer upload, regardless of the network type**. |
dnaUploadOnCellularAllowed* |
Getter/Setter to allow or not peer upload. |
dnaUploadOnWifiEthernetAllowed* |
Getter/Setter to allow or not peer upload. |
id |
Returns the ID of the Streamrooter running in the page. |
allContents (in Bytes) |
Stats that describe the whole session (stats are aggregated over successive contents that have been played in case of a playlist). |
currentContent (in Bytes) |
Stats that describe the current content being played. |
realtime.dnaSources |
Returns the current number of peers connected to the client. |
effectiveDownloadAllowed* |
Return the effective state of download (allowed or not). |
effectiveUploadAllowed* |
Return the effective state of upload (allowed or not). |
versions |
List of all Mesh Delivery components versions. |
* To learn more about the Download and Upload setters, please see our dedicated documentation.