-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from THEOplayer/maintenance/uplynk-refactoring
Maintenance/uplynk refactoring
- Loading branch information
Showing
5 changed files
with
349 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...va/com/theoplayer/android/connector/uplynk/internal/UplynkSsaiDescriptionUrlExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.theoplayer.android.connector.uplynk.internal | ||
|
||
import com.theoplayer.android.connector.uplynk.UplynkAssetType | ||
import com.theoplayer.android.connector.uplynk.UplynkSsaiDescription | ||
|
||
internal val UplynkSsaiDescription.drmParameters: String | ||
get() = if (contentProtected) { | ||
"&manifest=mpd&rmt=wv" | ||
} else { | ||
"" | ||
} | ||
|
||
internal val UplynkSsaiDescription.urlParameters | ||
get() = if (preplayParameters.isNotEmpty()) { | ||
preplayParameters.map { "${it.key}=${it.value}" }.joinToString("&", prefix = "&") | ||
} else { | ||
"" | ||
} | ||
|
||
internal val UplynkSsaiDescription.pingParameters: String | ||
get() { | ||
val feature = UplynkPingFeatures.from(this) | ||
return if (feature == UplynkPingFeatures.NO_PING) { | ||
"&ad.pingc=0" | ||
} else { | ||
"&ad.pingc=1&ad.pingf=${feature.pingfValue}" | ||
} | ||
} | ||
|
||
internal val UplynkSsaiDescription.urlAssetType | ||
get() = when (assetType) { | ||
UplynkAssetType.ASSET -> "" | ||
UplynkAssetType.CHANNEL -> "channel" | ||
UplynkAssetType.EVENT -> "event" | ||
} | ||
|
||
internal val UplynkSsaiDescription.urlAssetId | ||
get() = when { | ||
assetIds.isEmpty() && externalIds.size == 1 -> "$userId/${externalIds.first()}.json" | ||
assetIds.isEmpty() && externalIds.size > 1 -> "$userId/${externalIds.joinToString(",")}/multiple.json" | ||
assetIds.size == 1 -> "${assetIds.first()}.json" | ||
else -> assetIds.joinToString(separator = ",") + "/multiple.json" | ||
} |
Oops, something went wrong.