Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uplynk Ping API #35

Merged
merged 25 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e6f1921
Add PingResponse
OlegRyz Sep 3, 2024
453ed6b
Add ping request
OlegRyz Sep 3, 2024
75b2bb4
Implement PingScheduler
OlegRyz Sep 3, 2024
8ccc77d
Differentiate between preplay vod and preplay live requests
OlegRyz Sep 4, 2024
689beb4
Update documentation
OlegRyz Sep 4, 2024
7c10750
Set default value for interstitialURL
OlegRyz Sep 5, 2024
6a909ab
Fix unit tests
OlegRyz Sep 5, 2024
6711d80
Cancel ping couroutines in PingScheduler.destroy()
OlegRyz Sep 5, 2024
654129b
Rename onPreplayLiveResponse to correspond to PreplayLiveResponse dat…
OlegRyz Sep 5, 2024
1417fc0
Add explanation for extensions field
OlegRyz Sep 5, 2024
2ca3306
Remove mistakenly added field. This field is not documented in Uplynk…
OlegRyz Sep 5, 2024
3f6da7f
Add missing documentation
OlegRyz Sep 6, 2024
af63190
Fix pingResponse javadoc
OlegRyz Sep 6, 2024
95b87a4
Reformat ping configuration features calculation
OlegRyz Sep 6, 2024
33c94f8
Move PingResponse out of internal pcackage
OlegRyz Sep 6, 2024
72710af
Add drm to PreplayLiveResponse
OlegRyz Sep 6, 2024
fbaed1b
Rename PreplayVodResponse
OlegRyz Sep 6, 2024
9dc8216
Add Uplynk Live source
OlegRyz Sep 6, 2024
ca47878
Enable Ping in Uplynk Live source
OlegRyz Sep 6, 2024
82305b6
Add Ping listener to main activity
OlegRyz Sep 6, 2024
0d77e3c
Enable ping scheduler only if ping feature is requested.
OlegRyz Sep 6, 2024
5666726
Make UplynkPingFeatures internal
OlegRyz Sep 6, 2024
fdf08d8
Rename PreplayInternalVodResponse
OlegRyz Sep 9, 2024
47644f1
Delete leftover empty file
OlegRyz Sep 9, 2024
0584cf6
Make externalIds property name plural
OlegRyz Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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