Platform Extensions
Geo Location
The Quickplay Platform determines your user's geo-location based on the incoming client IP. To access the platform-determined geo location info, use the following extension API:
val locationResult = PlatformCoreExtensions.getGeoLocation(
"https://<host>",
platformAuthorizer,
queryParams
)
if (locationResult is Result.Success) {
val countryName = locationResult.value.countryName
} else if(locationResult is Result.Failure) {
val error = locationResult.value
logger.warn { "Failed to acquire location info: $error" }
}
Adobe Primetime - FLAT Token
To generate a Quickplay Access Token (FLAT) for TVE flows via Adobe Primetime, use the extension API below by passing the following information:
| Name | Type | Required | Description |
|---|---|---|---|
| deviceId | String | Required | Unique device identifier. Refer to Secure Playback for generating a unique device id. |
| deviceInfo | String | Required | Base64 encoded Device Info. Refer Adobe Primetime docs for the device info spec. |
| userId | String | Required | Adobe user identifier. |
| profileId | String | Optional | Unique identifier of the user profile. This is applicable only for multi-profile user accounts. |
val primeTokenResult = PlatformCoreExtensions.getAdobePrimetimeToken(
"https://<host>",
deviceId,
deviceInfo,
userId,
profileId,
platformAuthorizer
)
if (primeTokenResult is Result.Success) {
val flatToken = primeTokenResult.value.token
} else if(primeTokenResult is Result.Failure) {
val error = primeTokenResult.value
logger.warn { "Failed to acquire prime token: $error" }
}
Generic Platform API
All Quickplay Platform APIs are zero-trust protected and require an OAuth token. The Platform Core client library manages the OAuth token and abstracts the ability to securely communicate with the Quickplay Platform. While the client library exposes many Platform APIs as direct APIs, some tenant-specific APIs might not be available as direct APIs. In such cases, you can use the singleDataAuhtorizedCallWith and multiDataAuhtorizedCallWith APIs to communicate with the specific Platform API.
Create HttpClientConfiguration
HttpClientConfiguration allows configuring timeouts, retry policies, and custom interceptors for HTTP requests.
| Name | Type | Default value | Description |
|---|---|---|---|
| connectionTimeout | Long? | 30L | The connect timeout for new connections in seconds.The connect timeout is applied when connecting a TCP socket to the target host. |
| readTimeout | Long? | 30L | The default read timeout for new connections.The read timeout is applied to both the TCP socket and for individual read IO operations. |
| retryOnNetworkFailure | Boolean? | true | The value indicates whether retry isenabled for network connection failure. By default it is true |
| maxNetworkFailureRetryCount | Int? | 2 | The maximum number of times that the interceptor will attempt to recover from network connection failure before propagating an error. |
| baseNetworkFailureRetryDelayMs | Long? | 2000L | he base delay (in milliseconds) before the first retry. Subsequent retries will use an linear increasing delay based on this value. |
| applicationInterceptors | List<Interceptor>? | emptyList() | the list of custom interceptors to be added to http builders |
val httpClientConfig = HttpClientConfiguration.Builder()
.connectionTimeout(DEFAULT_HTTP_CLIENT_TIMEOUT_SECONDS)
.readTimeout(DEFAULT_HTTP_CLIENT_TIMEOUT_SECONDS)
.build()
Create Request
FoundationFactory.configureHttpClient(httpClientConfig)
Initiate Request
Initiate an authorized request using the singleDataAuhtorizedCallWith API on the HTTPClient instance. This API lets you initiate all standard HTTP requests and automatically injects the required Authentication headers to securely communicate with the Quickplay Platform.
suspend fun getLocation(): Result<FLLocation, Error> {
val response =
httpClient.singleDataAuhtorizedCallWith<Unit, FLLocation>(platformAuthorizer) {
url("https://<host>")
pathSegment("device/location/lookup")
get()
}.awaitPlatformResult()
return response.resolveServiceSingleDataResult()
}
Refer the Secure Playback section for creating platform authorizer instance.