Skip to main content
Skip table of contents

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 to onStatisticsUpdate (in milliseconds).
  • statisticsTypes defines the types of statistics to be included in the call to onStatisticsUpdate.
Statistics TypeValue
STATISTICS_TYPE.NONE0No statistics passed to onStatisticsUpdate
STATISTICS_TYPE.RENDERING1

Enable rendering-related statistics:

  • framesPerSecondNominal
  • framesPerSecond
  • frameDrops
  • frameDropsPerSecond
STATISTICS_TYPE.NETWORK2

Enable network-related statistics:

  • availableBitrates
  • selectedBitrate
  • bytesDownloaded
  • url
  • finalUrl
  • downloadBitrate
  • downloadBitrateAverage
STATISTICS_TYPE.PLAYBACK4

Enable playback related statistics:

  • streamBitrate
  • resolutionWidth
  • resolutionHeight
STATISTICS_TYPE.EVENT8

Enable event-related statistics (not yet implemented)

STATISTICS_TYPE.DRM16

Enable DRM-related statistics (not yet implemented)

STATISTICS_TYPE.ALL~0Enable all types of statistics

STATISTICS_TYPE is a bitmask. The different types can be combined using bitwise operations:

JS
    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

JS
<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));}}
    ...
    />
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.