Class: shaka.util.Uint8ArrayUtils

A set of Uint8Array utility functions.

Constructor

new Uint8ArrayUtils()

A set of Uint8Array utility functions.

Source:

Methods

concat(…varArgs) → {Uint8Array}

Concatenate buffers.
Parameters:
Name Type Attributes Description
varArgs BufferSource <repeatable>
Source:
Returns:
Type
Uint8Array

concatRange(arraynon-null, startopt, endopt) → {Uint8Array}

Concatenate a range of buffers from a flat array. Avoids a subarray allocation compared to concat(...array.slice(s, e)).
Parameters:
Name Type Attributes Default Description
array Array<!BufferSource>
start number <optional>
0 Inclusive start index.
end number <optional>
Exclusive end index.
Source:
Returns:
Type
Uint8Array

fromBase64(str) → {Uint8Array}

Convert a base64 string to a Uint8Array. Accepts either the standard alphabet or the alternate "base64url" alphabet.
Parameters:
Name Type Description
str string
Source:
Returns:
Type
Uint8Array

fromHex(str) → {Uint8Array}

Convert a hex string to a Uint8Array.
Parameters:
Name Type Description
str string
Source:
Returns:
Type
Uint8Array

removeEmulationPreventionBytes(datanon-null) → {Uint8Array}

Removes H.264/H.265/H.266 emulation prevention bytes (the 0x03 that follows a 0x00 0x00 sequence) from a NAL unit, i.e. converts EBSP to RBSP. Builds the result in a single pass into a freshly allocated array. Using a new array (rather than shifting bytes in place) keeps Chromium (VDA) happy about NAL unit length conformance.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Uint8Array

toBase64(data, paddingopt) → {string}

Convert a buffer to a base64 string. The output will always use the alternate encoding/alphabet also known as "base64url".
Parameters:
Name Type Attributes Description
data BufferSource
padding boolean <optional>
If true, pad the output with equals signs. Defaults to true.
Source:
Returns:
Type
string

toHex(data) → {string}

Convert a buffer to a hex string.
Parameters:
Name Type Description
data BufferSource
Source:
Returns:
Type
string

toStandardBase64(data) → {string}

Convert a buffer to a base64 string. The output will be standard alphabet as opposed to base64url safe alphabet.
Parameters:
Name Type Description
data BufferSource
Source:
Returns:
Type
string