YouTube.js
Guide
Discord
❤️ Sponsor
GitHub
Guide
Discord
❤️ Sponsor
GitHub

googlevideo / exports/sabr-streaming-adapter / SabrStreamingAdapter

Class: SabrStreamingAdapter

Defined in: src/core/SabrStreamingAdapter.ts:76

Adapter class that handles YouTube SABR integration with media players (e.g., Shaka Player).

What it does:

  • Sets up request/response interceptors so proper SABR requests can be sent (UMP response parsing must be done in the player adapter).
  • Keeps track of initialized formats and their metadata.
  • Handles SABR-specific things, such as redirects, context updates, and playback cookies.

Constructors

Constructor

new SabrStreamingAdapter(options): SabrStreamingAdapter

Defined in: src/core/SabrStreamingAdapter.ts:128

Parameters

options

SabrOptions

Configuration options for the adapter.

Returns

SabrStreamingAdapter

Throws

SabrAdapterError if a player adapter is not provided.

Properties

isDisposed

isDisposed: boolean = false

Defined in: src/core/SabrStreamingAdapter.ts:99

Methods

onSnackbarMessage()

onSnackbarMessage(cb): void

Defined in: src/core/SabrStreamingAdapter.ts:104

Registers a callback function to handle snackbar messages.

Parameters

cb

OnSnackbarMessageCb

Returns

void


onReloadPlayerResponse()

onReloadPlayerResponse(cb): void

Defined in: src/core/SabrStreamingAdapter.ts:112

Handles server requests to reload the player with new parameters.

Parameters

cb

OnReloadPlayerResponseCb

Returns

void


onMintPoToken()

onMintPoToken(cb): void

Defined in: src/core/SabrStreamingAdapter.ts:120

Registers a callback function to mint a new PoToken.

Parameters

cb

OnMintPoTokenCallback

Returns

void


attach()

attach(player): void

Defined in: src/core/SabrStreamingAdapter.ts:152

Initializes the player adapter and sets up request/response interceptors.

Parameters

player

any

Returns

void

Throws

SabrAdapterError if the adapter has been disposed.


setStreamingURL()

setStreamingURL(url?): void

Defined in: src/core/SabrStreamingAdapter.ts:162

Sets the initial server abr streaming URL.

Parameters

url?

string

Returns

void

Throws

SabrAdapterError if the adapter has been disposed.


setUstreamerConfig()

setUstreamerConfig(ustreamerConfig?): void

Defined in: src/core/SabrStreamingAdapter.ts:171

Sets the ustreamer configuration for SABR requests.

Parameters

ustreamerConfig?

string

Returns

void

Throws

SabrAdapterError if the adapter has been disposed.


setServerAbrFormats()

setServerAbrFormats(sabrFormats): void

Defined in: src/core/SabrStreamingAdapter.ts:180

Sets the available SABR formats for streaming.

Parameters

sabrFormats

SabrFormat[]

Returns

void

Throws

SabrAdapterError if the adapter has been disposed.


getCacheManager()

getCacheManager(): CacheManager | null

Defined in: src/core/SabrStreamingAdapter.ts:188

Returns the cache manager instance, if caching is enabled.

Returns

CacheManager | null


dispose()

dispose(): void

Defined in: src/core/SabrStreamingAdapter.ts:637

Releases resources and cleans up the adapter instance. After calling dispose, the adapter can no longer be used.

Returns

void

Edit this page
Last Updated: 10/20/26, 8:11 PM