Bytes

class Bytes(val bytes: ByteArray, val hint: FormatHint? = null) : MediaSource(source)

Bytes already in memory.

On Android, Apple and ffmpeg the buffer is written to a file in a temporary directory, because that is what the platform readers open. Every read of one buffer lands on the one file, so a buffer costs its size on disk as well as in memory. The file stays until a later process first uses a buffer, so a process reading many distinct buffers grows disk use with no bound. In a browser it stays in memory.

Equality reads the whole of bytes, so treat the array as owned by this source once you hand it over. Writing into it afterwards is unsupported, because the hash is only computed once.

Constructors

Link copied to clipboard
constructor(bytes: ByteArray, hint: FormatHint? = null)

Properties

Link copied to clipboard

The encoded media, container and all.

Link copied to clipboard

What container bytes holds, or null to read it off the bytes themselves.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int

Memoized, because a source is used as a map key on the probe path and bytes can be hundreds of megabytes.