public final class PlayerEmsgHandler.PlayerTrackEmsgHandler extends Object implements TrackOutput
TrackOutput.CryptoData
Modifier and Type | Method and Description |
---|---|
void |
format(Format format)
Called when the
Format of the track has been extracted from the stream. |
boolean |
maybeRefreshManifestBeforeLoadingNextChunk(long presentationPositionUs)
For live streaming, check if the DASH manifest is expired before the next segment start time.
|
boolean |
maybeRefreshManifestOnLoadingError(Chunk chunk)
For live streaming with emsg event stream, forward seeking can seek pass the emsg messages
that signals end-of-stream or Manifest expiry, which results in load error.
|
void |
onChunkLoadCompleted(Chunk chunk)
Called when the a new chunk in the current media stream has been loaded.
|
void |
release()
Release this track emsg handler.
|
int |
sampleData(ExtractorInput input,
int length,
boolean allowEndOfInput)
Called to write sample data to the output.
|
void |
sampleData(ParsableByteArray data,
int length)
Called to write sample data to the output.
|
void |
sampleMetadata(long timeUs,
int flags,
int size,
int offset,
TrackOutput.CryptoData encryptionData)
Called when metadata associated with a sample has been extracted from the stream.
|
public void format(Format format)
TrackOutput
Format
of the track has been extracted from the stream.format
in interface TrackOutput
format
- The extracted Format
.public int sampleData(ExtractorInput input, int length, boolean allowEndOfInput) throws IOException, InterruptedException
TrackOutput
sampleData
in interface TrackOutput
input
- An ExtractorInput
from which to read the sample data.length
- The maximum length to read from the input.allowEndOfInput
- True if encountering the end of the input having read no data is
allowed, and should result in C.RESULT_END_OF_INPUT
being returned. False if it
should be considered an error, causing an EOFException
to be thrown.IOException
- If an error occurred reading from the input.InterruptedException
- If the thread was interrupted.public void sampleData(ParsableByteArray data, int length)
TrackOutput
sampleData
in interface TrackOutput
data
- A ParsableByteArray
from which to read the sample data.length
- The number of bytes to read.public void sampleMetadata(long timeUs, int flags, int size, int offset, @Nullable TrackOutput.CryptoData encryptionData)
TrackOutput
The corresponding sample data will have already been passed to the output via calls to
TrackOutput.sampleData(ExtractorInput, int, boolean)
or TrackOutput.sampleData(ParsableByteArray,
int)
.
sampleMetadata
in interface TrackOutput
timeUs
- The media timestamp associated with the sample, in microseconds.flags
- Flags associated with the sample. See C.BUFFER_FLAG_*
.size
- The size of the sample data, in bytes.offset
- The number of bytes that have been passed to TrackOutput.sampleData(ExtractorInput,
int, boolean)
or TrackOutput.sampleData(ParsableByteArray, int)
since the last byte belonging
to the sample whose metadata is being passed.encryptionData
- The encryption data required to decrypt the sample. May be null.public boolean maybeRefreshManifestBeforeLoadingNextChunk(long presentationPositionUs)
presentationPositionUs
- The next load position in presentation time.public void onChunkLoadCompleted(Chunk chunk)
chunk
- The chunk whose load has been completed.public boolean maybeRefreshManifestOnLoadingError(Chunk chunk)
chunk
- The chunk whose load encountered the error.public void release()