Response
Mutable representation of an HTTP response received by the native player (for example a DRM license or certificate response).
Instances are created by the SDK and handed to response modifiers — such as
a DrmResponseModifier or a custom modifier registered with the
DrmEnvironmentAdapter — which may inspect or mutate the response before it
is consumed by the native player. Calling
setHeaders or setBody
marks the response as dirty (see isDirty); the
SDK then forwards the modified headers and body to the native layer. If no
setter is called the response is consumed unchanged.
The status code and URL are immutable once a response has been received.
Applications should not construct Response instances directly.
Methods
getId()
getId():
string
Returns the opaque identifier that correlates this response with the originating Request.
Returns
string
getType()
getType():
ResourceType
Returns the kind of resource this response carries (e.g. a DRM license).
Returns
getStatus()
getStatus():
number
Returns the HTTP status code of the response.
Returns
number
isDirty()
isDirty():
boolean
Returns true if setHeaders or
setBody has been called on this response, in
which case the SDK will forward the modified values to the native layer.
Returns
boolean
getUrl()
getUrl():
string
Returns the URL the response was received from. This may differ from the original request URL when the server issued redirects.
Returns
string
getHeaders()
getHeaders():
Record<string,string>
Returns the current response headers as a plain object. The returned object is the live backing store — mutating it directly will not mark the response as dirty; use setHeaders instead.
Returns
Record<string, string>
setHeaders()
setHeaders(
headers):void
Replaces the response headers and marks the response as dirty. The provided map fully replaces any previously received headers.
Parameters
| Parameter | Type | Description |
|---|---|---|
headers | Record<string, string> | The complete set of headers to forward to the native player. |
Returns
void
getBody()
getBody():
Uint8Array
Returns the current response body as a byte buffer.
Returns
setBody()
setBody(
body):void
Replaces the response body and marks the response as dirty. This is commonly used to unwrap DRM license payloads returned by proxy servers.
Parameters
| Parameter | Type | Description |
|---|---|---|
body | Uint8Array | The raw bytes to forward to the native player as the response body. |
Returns
void