Skip to main content

Platform Extensions

Geo Location

The Quickplay Platform determines user's geo-location based on 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 below extension API by passing the following info:

NameTypeRequiredDescription
deviceIdStringRequiredUnique device identifier. Refer to Secure Playback for generating a unique device id.
deviceInfoStringRequiredBase64 encoded Device Info. Refer Adobe Primetime docs for the device info spec.
userIdStringRequiredAdobe user identifier.
profileIdStringOptionalUnique 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 OAuth token. The Platform Core client library manages the OAuth token and abstracts the ability to securely communicate with the Quickplay Platform. While many of the Platform APIs are exposed as direct APIs, some tenent specific APIs might not be available as direct API on the client library. In such cases, application could 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.

NameTypeDefault valueDescription
connectionTimeoutLong?30LThe connect timeout for new connections in seconds.The connect timeout is applied when connecting a TCP socket to the target host.
readTimeoutLong?30LThe default read timeout for new connections.The read timeout is applied to both the TCP socket and for individual read IO operations.
retryOnNetworkFailureBoolean?trueThe value indicates whether retry isenabled for network connection failure. By default it is true
maxNetworkFailureRetryCountInt?2The maximum number of times that the interceptor will attempt to recover from network connection failure before propagating an error.
baseNetworkFailureRetryDelayMsLong?2000Lhe base delay (in milliseconds) before the first retry. Subsequent retries will use an linear increasing delay based on this value.
applicationInterceptorsList<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 allows initiating 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()
}
note

Refer the Secure Playback section for creating platform authorizer instance.