OpenTV Player Web HTML5

Class: NetworkStatistics

NetworkStatistics

Provides statistics on network usage, and listeners which provide network usage info. Objects of this class are instantiated by OtvToolkit, and should not be instantiated directly. The statistics available will depend on the type of content being downloaded.

new NetworkStatistics()

Methods

addNetworkListener(networkStatisticsListener)

Add a listener for network statistics events to listener list

Name Type Description
networkStatisticsListener Object
Name Type Description
availableBitratesChanged callback

fired on possible change of available bitrates

selectedBitrateChanged callback

fired on change of selected bitrate

urlChanged callback

fired on each different file downloaded

errorChanged callback

fired on HTTP error

httpProcessingEnded callback

fired on file downloaded passing the following download information { startTime, endTime, duration, url, mimeType }

Provides information on the available bitrates, and the bitrate selected for download

Returns:
Type Description
NetworkStatistics~adaptiveStreamingObject

Provides information about the content server

Returns:
Type Description
NetworkStatistics~contentServerObject

Provides information about the amount and rates of downloads

Returns:
Type Description
NetworkStatistics~networkUsageObject

removeNetworkListener(networkStatisticsListener)

Remove the listener for network statistics events from listener list

Name Type Description
networkStatisticsListener Object

reset()

Resets the network statistics

setNetworkListener(networkStatisticsListener)

Sets listeners for network statistics events

Name Type Description
networkStatisticsListener Object
Name Type Description
availableBitratesChanged callback

fired on possible change of available bitrates

selectedBitrateChanged callback

fired on change of selected bitrate

urlChanged callback

fired on each different file downloaded

errorChanged callback

fired on HTTP error

httpProcessingEnded callback

fired on file downloaded passing the following download information { startTime, endTime, duration, url, mimeType }

Type Definitions

adaptiveStreamingObjectObject

An object which defines the adaptiveStreaming statistics

Properties:
Name Type Description
selectedBitrate number

bitrate currently selected for download

availableBitrates Array.<number>

the bitrates available for download

contentServerObjectObject

An object describing the content server

Properties:
Name Type Description
url string

Provides the URL of the downloaded file. The exact file (manifest or fragment) will depend on the type of content.

networkUsageObject

An object which defines the NetworkUsage statistics

Properties:
Name Type Description
bytesDownloaded number

total bytes downloaded (video + audio)

downloadBitrate number

bits/s for last video segment downloaded

downloadBitrateAverage number

bits/s averaged over the last 5 video segments