ChunkIndexMerger


@UnstableApi
public final class ChunkIndexMerger


A utility class for merging multiple ChunkIndex instances into a single .

This is useful in scenarios where media is split across multiple segments or sources, and a unified index is needed for seeking or playback.

Summary

Public constructors

Creates an instance.

Public methods

void
add(ChunkIndex chunk)

Adds a ChunkIndex to be merged.

void

Clears all added chunk indices and internal state.

ChunkIndex

Returns a single ChunkIndex that merges all added chunk indices.

int

Returns the number of chunk indices added so far.

Public constructors

ChunkIndexMerger

public ChunkIndexMerger()

Creates an instance.

Public methods

add

public void add(ChunkIndex chunk)

Adds a ChunkIndex to be merged.

Chunk indices with duplicate starting timestamps are ignored to avoid redundant data.

Parameters
ChunkIndex chunk

The ChunkIndex to add.

clear

public void clear()

Clears all added chunk indices and internal state.

merge

public ChunkIndex merge()

Returns a single ChunkIndex that merges all added chunk indices.

size

public int size()

Returns the number of chunk indices added so far.