Skip to content

Commit

Permalink
Merge pull request #35 from THEOplayer/feature/uplynk-ping
Browse files Browse the repository at this point in the history
Uplynk Ping API
  • Loading branch information
OlegRyz authored Sep 9, 2024
2 parents 6c3b159 + 0584cf6 commit beb97f6
Show file tree
Hide file tree
Showing 20 changed files with 693 additions and 77 deletions.
15 changes: 12 additions & 3 deletions app/src/main/java/com/theoplayer/android/connector/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import com.theoplayer.android.connector.analytics.nielsen.NielsenConnector
import com.theoplayer.android.connector.uplynk.UplynkConnector
import com.theoplayer.android.connector.uplynk.UplynkListener
import com.theoplayer.android.connector.uplynk.network.AssetInfoResponse
import com.theoplayer.android.connector.uplynk.network.PreplayResponse
import com.theoplayer.android.connector.uplynk.network.PingResponse
import com.theoplayer.android.connector.uplynk.network.PreplayLiveResponse
import com.theoplayer.android.connector.uplynk.network.PreplayVodResponse
import com.theoplayer.android.connector.yospace.YospaceConnector

const val TAG = "MainActivity"
Expand Down Expand Up @@ -152,8 +154,12 @@ class MainActivity : AppCompatActivity() {
private fun setupUplynk() {
uplynkConnector = UplynkConnector(theoplayerView)
uplynkConnector.addListener(object: UplynkListener {
override fun onPreplayResponse(response: PreplayResponse) {
Log.d("UplynkConnectorEvents", "PREPLAY_RESPONSE $response")
override fun onPreplayVodResponse(response: PreplayVodResponse) {
Log.d("UplynkConnectorEvents", "PREPLAY_VOD_RESPONSE $response")
}

override fun onPreplayLiveResponse(response: PreplayLiveResponse) {
Log.d("UplynkConnectorEvents", "PREPLAY_LIVE_RESPONSE $response")
}

override fun onAssetInfoResponse(response: AssetInfoResponse) {
Expand All @@ -168,6 +174,9 @@ class MainActivity : AppCompatActivity() {
Log.d("UplynkConnectorEvents", "ASSET_INFO_RESPONSE Failure $exception")
}

override fun onPingResponse(pingResponse: PingResponse) {
Log.d("UplynkConnectorEvents", "PING_RESPONSE $pingResponse")
}
})

theoplayerView.player.ads.addEventListener(AdsEventTypes.AD_ERROR) {
Expand Down
68 changes: 54 additions & 14 deletions app/src/main/java/com/theoplayer/android/connector/Sources.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import com.theoplayer.android.api.source.SourceType
import com.theoplayer.android.api.source.TypedSource
import com.theoplayer.android.api.source.addescription.GoogleImaAdDescription
import com.theoplayer.android.api.source.metadata.MetadataDescription
import com.theoplayer.android.connector.uplynk.UplynkAssetType
import com.theoplayer.android.connector.uplynk.UplynkPingConfiguration
import com.theoplayer.android.connector.uplynk.UplynkSsaiDescription
import com.theoplayer.android.connector.yospace.YospaceSsaiDescription
import com.theoplayer.android.connector.yospace.YospaceStreamType
Expand Down Expand Up @@ -111,20 +113,58 @@ val sources: List<Source> by lazy {
.Builder()
.prefix("https://content.uplynk.com")
.assetInfo(true)
.assetIds(listOf(
"41afc04d34ad4cbd855db52402ef210e",
"c6b61470c27d44c4842346980ec2c7bd",
"588f9d967643409580aa5dbe136697a1",
"b1927a5d5bd9404c85fde75c307c63ad",
"7e9932d922e2459bac1599938f12b272",
"a4c40e2a8d5b46338b09d7f863049675",
"bcf7d78c4ff94c969b2668a6edc64278",
))
.preplayParameters(linkedMapOf(
"ad" to "adtest",
"ad.lib" to "15_sec_spots"
))
.build())
.assetIds(
listOf(
"41afc04d34ad4cbd855db52402ef210e",
"c6b61470c27d44c4842346980ec2c7bd",
"588f9d967643409580aa5dbe136697a1",
"b1927a5d5bd9404c85fde75c307c63ad",
"7e9932d922e2459bac1599938f12b272",
"a4c40e2a8d5b46338b09d7f863049675",
"bcf7d78c4ff94c969b2668a6edc64278",
)
)
.preplayParameters(
linkedMapOf(
"ad" to "adtest",
"ad.lib" to "15_sec_spots"
)
)
.build()
)
.build()
)
.build()
),
Source(
name = "Uplynk Live",
sourceDescription = SourceDescription
.Builder(
TypedSource.Builder("no source")
.ssai(
UplynkSsaiDescription
.Builder()
.prefix("https://content.uplynk.com")
.assetInfo(false)
.assetType(UplynkAssetType.CHANNEL)
.assetIds(
listOf(
"3c367669a83b4cdab20cceefac253684",
)
)
.preplayParameters(
linkedMapOf(
"ad" to "cleardashnew",
)
)
.pingConfiguration(
UplynkPingConfiguration.Builder()
.linearAdData(true)
.adImpressions(false)
.freeWheelVideoViews(false)
.build())
.build()
)
.build()
)
.build()
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.theoplayer.android.connector.uplynk

import com.theoplayer.android.connector.uplynk.network.PingResponse
import com.theoplayer.android.connector.uplynk.network.AssetInfoResponse
import com.theoplayer.android.connector.uplynk.network.PreplayResponse
import com.theoplayer.android.connector.uplynk.network.PreplayLiveResponse
import com.theoplayer.android.connector.uplynk.network.PreplayVodResponse

/**
* A listener interface for receiving events related to Uplynk
Expand All @@ -14,9 +16,18 @@ interface UplynkListener {
*
* For more details, refer to the [Preplay API (Version 2) Documentation](https://docs.edgecast.com/video/index.html#Develop/Preplayv2.htm).
*
* @param response the `PreplayResponse` object containing information relevant to the preplay request.
* @param response the `PreplayVodResponse` object containing information relevant to the preplay request.
*/
fun onPreplayResponse(response: PreplayResponse) {}
fun onPreplayVodResponse(response: PreplayVodResponse) {}

/**
* Called when a preplay response is received from Uplynk for live channel or an event.
*
* For more details, refer to the [Preplay API (Version 2) Documentation](https://docs.edgecast.com/video/index.html#Develop/Preplayv2.htm).
*
* @param response the `PreplayLiveResponse` object containing information relevant to the preplay request.
*/
fun onPreplayLiveResponse(response: PreplayLiveResponse){}

/**
* Called when a preplay response is received from Uplynk and failed to be parsed
Expand All @@ -40,4 +51,13 @@ interface UplynkListener {
* @param exception the `Exception` occurred during the request
*/
fun onAssetInfoFailure(exception: Exception) {}

/**
* Called when a ping response is received from Uplynk.
*
* For more details, refer to the [Ping API Documentation](https://docs.edgecast.com/video/#Develop/Pingv2.htm).
*
* @param pingResponse the `PingResponse` object containing ping request result
*/
fun onPingResponse(pingResponse: PingResponse) {}
}
Loading

0 comments on commit beb97f6

Please sign in to comment.