ConstantBitrateSeekMap


@UnstableApi
class ConstantBitrateSeekMap : SeekMap


A SeekMap implementation that assumes the stream has a constant bitrate and consists of multiple independent frames of the same size. Seek points are calculated to be at frame boundaries.

Summary

Public constructors

ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int
)

Creates an instance with allowSeeksIfLengthUnknown set to false.

ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int,
    allowSeeksIfLengthUnknown: Boolean
)

Creates an instance.

Public functions

SeekMap.SeekPoints!

Obtains seek points for the specified seek time in microseconds.

Long

Returns the stream time in microseconds for a given position.

Boolean

Returns whether seeking is supported.

Public properties

Long

Public constructors

ConstantBitrateSeekMap

ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int
)

Creates an instance with allowSeeksIfLengthUnknown set to false.

Parameters
inputLength: Long

The length of the stream in bytes, or LENGTH_UNSET if unknown.

firstFrameBytePosition: Long

The byte-position of the first frame in the stream.

bitrate: Int

The bitrate (which is assumed to be constant in the stream).

frameSize: Int

The size of each frame in the stream in bytes. May be LENGTH_UNSET if unknown.

ConstantBitrateSeekMap

ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int,
    allowSeeksIfLengthUnknown: Boolean
)

Creates an instance.

Parameters
inputLength: Long

The length of the stream in bytes, or LENGTH_UNSET if unknown.

firstFrameBytePosition: Long

The byte-position of the first frame in the stream.

bitrate: Int

The bitrate (which is assumed to be constant in the stream).

frameSize: Int

The size of each frame in the stream in bytes. May be LENGTH_UNSET if unknown.

allowSeeksIfLengthUnknown: Boolean

Whether to allow seeking even if the length of the content is unknown.

Public functions

getSeekPoints

fun getSeekPoints(timeUs: Long): SeekMap.SeekPoints!

Obtains seek points for the specified seek time in microseconds. The returned will contain one or two distinct seek points.

Two seek points [A, B] are returned in the case that seeking can only be performed to discrete points in time, there does not exist a seek point at exactly the requested time, and there exist seek points on both sides of it. In this case A and B are the closest seek points before and after the requested time. A single seek point is returned in all other cases.

Parameters
timeUs: Long

A seek time in microseconds.

Returns
SeekMap.SeekPoints!

The corresponding seek points.

getTimeUsAtPosition

fun getTimeUsAtPosition(position: Long): Long

Returns the stream time in microseconds for a given position.

Parameters
position: Long

The stream byte-position.

Returns
Long

The stream time in microseconds for the given position.

isSeekable

fun isSeekable(): Boolean

Returns whether seeking is supported.

Returns
Boolean

Whether seeking is supported.

Public properties

durationUs

val durationUsLong