Class: shaka.offline.StreamBandwidthEstimator

Constructor

new StreamBandwidthEstimator()

Source:

Members

DEFAULT_AUDIO_BITRATE_ :number

Since audio bandwidth does not vary much, we are going to use a constant approximation for audio bit rate allowing use to more accurately guess at the video bitrate. YouTube's suggested bitrate for stereo audio is 384 kbps so we are going to assume that: https://support.google.com/youtube/answer/1722171?hl=en
Type:
  • number
Source:

DEFAULT_IMAGE_BITRATE_ :number

Since we don't normally get the bitrate for image, we still want to create some approximation so that it can influence progress. The size of the thumbnail usually is 2KB.
Type:
  • number
Source:

DEFAULT_TEXT_BITRATE_ :number

Since we don't normally get the bitrate for text, we still want to create some approximation so that it can influence progress. This will use the bitrate from "Tears of Steal" to give some kind of data-driven result. The file size for English subtitles is 4.7 KB. The video is 12:14 long, which means that the text's bit rate is around 52 bps.
Type:
  • number
Source:

estimateByStreamId_ :Object.<number, number>

Type:
  • Object.<number, number>
Source:

Methods

addImage(image)

Create an estimate for the image stream.
Parameters:
Name Type Description
image shaka.extern.Stream
Source:

addText(text)

Create an estimate for the text stream.
Parameters:
Name Type Description
text shaka.extern.Stream
Source:

addVariant(variant)

Add a new variant to the estimator. This will update the estimates for all streams in the variant.
Parameters:
Name Type Description
variant shaka.extern.Variant
Source:

getEstimate_(id) → {number}

Parameters:
Name Type Description
id number
Source:
Returns:
Type
number

getInitSegmentEstimate(id) → {number}

Get the estimate for an init segment for a stream that has already added to the estimator.
Parameters:
Name Type Description
id number
Source:
Returns:
Type
number

getSegmentEstimate(id, segmentnon-null) → {number}

Get the estimate for a segment that is part of a stream that has already added to the estimator.
Parameters:
Name Type Description
id number
segment shaka.media.SegmentReference
Source:
Returns:
Type
number

setBitrate_(stream, bitRate)

Parameters:
Name Type Description
stream number
bitRate number
Source: