Network API - HTTP Request/Response manipulation

Compatibility

Web SDKWeb SDK (Safari)Android SDKiOS / tvOS SDK
HLS master manifest request/response Manipulation(1)✅(3)
HLS variant manifest request/response Manipulation(1)✅(3)
DASH manifest request/response Manipulation(1)N/AN/A
Media segments request/response Manipulation(1)✖️N/A
Widevine DRM licence(1), (2)N/AN/A
Playready DRM licence(1), (2)N/AN/AN/A
Fairplay DRM licence/ certificate(1), (2)N/AN/A

✅-Supported, N/A-Not Available per platform restrictions, ✖️-Not Supported

(1) Supported through NetworkConfig API

(2) Supported through DrmConfig API

(3) Supported when using native_hls_parsing tweak

Overview

Bitmovin Player SDKs provide several approaches to allow applications to intercept, manipulate and format HTTP requests and responses for Manifest, Media segments (audio/video/subtitle) and DRM licenses. This formatting is useful to enable well known use cases within the video workflow such as adding tokenization, formatting manifest files, formatting DRM license requests and responses, etc. Bitmovin player enables these use cases through two main APIs:

  • NetworkConfig: Intended for general network manipulation use cases including Manifest, Media Segment and DRM license requests and responses.
  • DrmConfig: Intended for DRM specific use cases.

The support of each API varies between different platforms so in the next sections we review the most common use cases for HTTP response/request manipulation and how they are supported by Bitmovin Player through each platform/SDK.

Common use cases

1. Adding custom data to Manifest/Media requests

Usually, players need to add custom data such as tokens for authentication, tracking, analytics, etc, prior to sending their requests to the CDN. To achieve this, typically the application requests for a token or generate any other custom data that lately is added to either the manifest or the segments requested. Usually the custom data or the token is appended to the request as:

  • A query parameter to HTTP URLs or

  • A Custom HTTP header

Bitmovin SDKs provide the NetworkConfig.preprocessHttpRequest API to allow applications to intercept and manipulate HTTP requests for Manifest and Media segments - audio, video and subtitles, that will be sent by the player.

2. Formatting Manifest/Media files

Sometimes manifest files or the media segments in the customer's ecosystem don’t fully meet the specs and may have some properties not fully compatible with Bitmovin player. In such cases, it could be useful to intercept and modify the manifest on the fly - in order to parse the data properly, before it is processed by the player.

Bitmovin SDKs provide the NetworkConfig.preprocessHttpResponse API to allow applications to intercept and manipulate HTTP responses for Manifest and Media segments - audio, video and subtitles.

3. Formatting DRM request/responses

Nearly every DRM license provider does have customized DRM workflows in place. This requires a custom formatting for either the DRM license requests and responses. Usually, the required DRM formatting implies:

  • Customizing HTTP headers for DRM requests

  • Formatting the payload data for DRM requests/responses

Bitmovin SDKs provides two ways to fully cover the previously mentioned use cases:

  • NetworkConfig APIs: It is possible to format the DRM request and response using the general Network APIs preprocessHttpRequest and preprocessHttpResponse respectively.

  • DrmConfig APIs: As formatting DRM license requests and responses is a common practice, Bitmovin SDKs also provide a straightforward way to handle this directly through the DrmConfig API. The API allows to set HTTP headers, prepare the payload for message license request, parse the payload on the license response, etc.

API Summary

  • For more information about NetworkConfig API to support HTTP request/response manipulations per Platform visit our API reference documentation. The following table summarize the available APIs for the use cases mentioned in this article:
  • For more information about the DrmConfig API to support the DRM formatting use cases visit our API reference documentation. The following table summarize the available APIs for the use cases mentioned in this article:
Setting headers for DRM license requestsPreparing the payload for DRM message requests
Web SDK - WidevineheadersprepareMessage
Web SDK - Fairplayheaders certificateheadersprepareMessage
Web SDK - PlayReadyheadersNA
Android SDK - WidevinesetHttpHeadersprepareMessage
iOS/tvOS SDK - FairplaylicenseRequestHeaders certificateRequestHeadersprepareMessage