Statistics
The statistics feature provides statistics information to the application, which can be used for debugging, server configuration etc. The information is provided using the event listener property onStatisticsUpdate
and controlled using configuration property statisticsTypes
.
statisticsConfig
statisticsConfig
is an object with members statisticsUpdateInterval
and statisticsTypes
.
statisticsUpdateInterval
defines the interval between successive calls toonStatisticsUpdate
(in milliseconds).statisticsTypes
defines the types of statistics to be included in the call toonStatisticsUpdate
.
Statistics Type | Value | |
---|---|---|
STATISTICS_TYPE.NONE | 0 | No statistics passed to onStatisticsUpdate |
STATISTICS_TYPE.RENDERING | 1 | Enable rendering-related statistics:
|
STATISTICS_TYPE.NETWORK | 2 | Enable network-related statistics:
|
STATISTICS_TYPE.PLAYBACK | 4 | Enable playback related statistics:
|
STATISTICS_TYPE.EVENT | 8 | Enable event-related statistics (not yet implemented) |
STATISTICS_TYPE.DRM | 16 | Enable DRM-related statistics (not yet implemented) |
STATISTICS_TYPE.ALL | ~0 | Enable all types of statistics |
STATISTICS_TYPE
is a bitmask. The different types can be combined using bitwise operations:
statisticsConfig={{
statisticsUpdateInterval: 2000, // Two seconds
statisticsTypes: STATISTICS_TYPE.RENDERING | STATISTICS_TYPE.NETWORK
}}
onStatisticsUpdate
onStatisticsUpdate
is passed a single parameter: an object which will contain values for those statistics which have been enabled by statisticsConfig.statisticsTypes
. Statistics which are not supported on the platform will be omitted from the object
statisticsConfig
are not tracked for changes for a content playback request. Any changes to statisticsConfig
will not take effect until the next time the source.url
property changes.
Example
<OTVPlayer
ref={otvplayerInstance}
source={source}
progressUpdateInterval={1}
autoplay={true}
statisticsConfig={{statisticsUpdateInterval: 1500, statisticsTypes: STATISTICS_TYPE.ALL}}
onStatisticsUpdate={(stats) => {console.log("statistics: " + JSON.stringify(stats, null, 4));}}
...
/>