Skip to content

Commit

Permalink
added LicenseCipherError
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyu04 committed Nov 20, 2023
1 parent ca4bd98 commit e04ca9f
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
ext.coroutines_version = '1.6.0'
ext.gson_version = '2.10'
ext.crypto_ktx_verion = '1.1.0-alpha03'
ext.pallycon_version = '3.4.4'
ext.pallycon_version = '3.4.5'
ext.data_binding_version = '3.5.0'
repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ enum class EventType(private var type: String) {
NetworkConnectedError("networkConnectedError"),
DetectedDeviceTimeModifiedError("detectedDeviceTimeModifiedError"),
MigrationError("migrationError"),
LicenseCipherError("licenseCipherError"),
UnknownError("unknownError");

override fun toString(): String {
return type
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ class PallyConSdk constructor(val context: Context) {
EventType.MigrationError,
e.msg
)

is PallyConException.PallyConLicenseCipherException ->
instance?.pallyConEvent?.sendPallyConEvent(
url,
EventType.LicenseCipherError,
e.msg
)
else ->
instance?.pallyConEvent?.sendPallyConEvent(
url, EventType.UnknownError,
Expand Down Expand Up @@ -151,6 +156,9 @@ class PallyConSdk constructor(val context: Context) {

fun setPallyConEvent(pallyConEvent: PallyConEvent?) {
this.pallyConEvent = pallyConEvent
if (wvSDKList.isNotEmpty()) {
wvSDKList.entries.first()?.value.setPallyConEventListener(listener)
}
}

fun setDownloadProgressEvent(downloadProgressEvent: DownloadProgressEvent?) {
Expand Down Expand Up @@ -212,7 +220,7 @@ class PallyConSdk constructor(val context: Context) {

suspend fun getObjectForContent(config: PallyConContentConfiguration): String {
return suspendCancellableCoroutine<String> { continuation ->
if (wvSDKList[config.contentId] != null) {
if (wvSDKList[config.contentId] != null && config.contentUrl != null) {
wvSDKList[config.contentId]!!.updateSecure({
print("update secure time")
val index =
Expand All @@ -221,11 +229,11 @@ class PallyConSdk constructor(val context: Context) {
val gson = Gson().toJson(contentDataList[index])
continuation.resume(gson, null)
} else {
continuation.resume(config.contentUrl, null)
continuation.resume(config.contentUrl!!, null)
}
}, { e ->
pallyConEvent?.sendPallyConEvent(
config.contentUrl,
config.contentUrl!!,
EventType.DetectedDeviceTimeModifiedError,
e.msg
)
Expand Down Expand Up @@ -257,21 +265,18 @@ class PallyConSdk constructor(val context: Context) {

fun addStartDownload(config: PallyConContentConfiguration) {
val data = createContentData(config)

if (!contentDataList.contains(data)) {
contentDataList.add(data)
}

if (!wvSDKList.containsKey(config.contentId)) {
wvSDKList[config.contentId] = PallyConWvSDK.createPallyConWvSDK(
if (!wvSDKList.containsKey(config.contentId) && config.contentId != null) {
wvSDKList[config.contentId!!] = PallyConWvSDK.createPallyConWvSDK(
context,
data
)
}

if (wvSDKList.size == 1) {
wvSDKList.entries.first()?.value.setPallyConEventListener(listener)
}

wvSDKList[config.contentId]?.also { sdk ->
sdk.updateSecure({
print("update secure time")
Expand All @@ -286,21 +291,21 @@ class PallyConSdk constructor(val context: Context) {
when (e) {
is PallyConException.NetworkConnectedException ->
pallyConEvent?.sendPallyConEvent(
config.contentUrl,
config.contentUrl ?: "",
EventType.NetworkConnectedError,
e.msg
)

is PallyConException.ContentDataException ->
pallyConEvent?.sendPallyConEvent(
config.contentUrl,
config.contentUrl ?: "",
EventType.ContentDataError,
e.msg
)

else ->
pallyConEvent?.sendPallyConEvent(
config.contentUrl,
config.contentUrl ?: "",
EventType.DownloadError,
e.msg
)
Expand All @@ -322,12 +327,12 @@ class PallyConSdk constructor(val context: Context) {
sdk.download(tracks)
} catch (e: PallyConException.ContentDataException) {
pallyConEvent?.sendPallyConEvent(
config.contentUrl,
config.contentUrl ?: "",
EventType.ContentDataError,
e.msg
)
} catch (e: PallyConException.DownloadException) {
pallyConEvent?.sendPallyConEvent(config.contentUrl, EventType.DownloadError, e.msg)
pallyConEvent?.sendPallyConEvent(config.contentUrl ?: "", EventType.DownloadError, e.msg)
}
}
}
Expand Down Expand Up @@ -427,8 +432,12 @@ class PallyConSdk constructor(val context: Context) {
}

var isOK = true
if (config.contentId == null) {
return false
}

wvSDKList[config.contentId]?.let {
isOK = it.migrateDownloadedContent(config.contentId, null)
isOK = it.migrateDownloadedContent(config.contentId!!, null)
}

return isOK
Expand Down Expand Up @@ -528,7 +537,8 @@ class PallyConSdk constructor(val context: Context) {
url = config.contentUrl,
localPath = "",
drmConfig = drmConfig,
cookie = config.contentCookie
cookie = config.contentCookie,
httpHeaders = contentHeaders
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions pallycon-drm-sdk/pallycon_drm_sdk_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.0.2
# pallycon_drm_sdk_interface:
# path: ../pallycon_drm_sdk_interface
pallycon_drm_sdk_interface: ^1.1.0
pallycon_drm_sdk_interface:
path: ../pallycon_drm_sdk_interface
# pallycon_drm_sdk_interface: ^1.1.0

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ enum PallyConEventType {
detectedDeviceTimeModifiedError,
/// Error that occurs when migrating from SDK
migrationError,
/// Error that occurs when a license cipher from SDK
licenseCipherError,
/// Unknown error type
unknown
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ class PallyConEvent {
url: pallyConEvent['url'],
message: pallyConEvent['message']
);
case 'licenseCipherError':
return PallyConEvent(
eventType: PallyConEventType.licenseCipherError,
url: pallyConEvent['url'],
message: pallyConEvent['message']
);
default:
return PallyConEvent(
eventType: PallyConEventType.unknown,
Expand Down
3 changes: 1 addition & 2 deletions player-samples/advanced/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"

// 3rd library
// implementation files('/Users/sungjuyun/inka/pallycon-drm-sdk-flutter/player-samples/advanced/android/app/libs/PallyConLicenseCipher.aar')
implementation (name:"PallyConLicenseCipher", ext:"aar")
// implementation (name:"PallyConLicenseCipher", ext:"aar")

// Gson
implementation "com.google.code.gson:gson:2.9.1"
Expand Down
4 changes: 1 addition & 3 deletions player-samples/advanced/assets/user_content.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"media_type": "video",
"stream_format": "dash",
"video_profile": "Main",
"token": "eyJrZXlfcm90YXRpb24iOmZhbHNlLCJyZXNwb25zZV9mb3JtYXQiOiJvcmlnaW5hbCIsInVzZXJfaWQiOiJ0ZXN0VXNlciIsImRybV90eXBlIjoid2lkZXZpbmUiLCJzaXRlX2lkIjoiREVNTyIsImhhc2giOiIzMEZkbGxpWndcL1wvVCs3ajBrQWFCZW9pUGQ3cVIyVmVRWjR2aUowcEdMUms9IiwiY2lkIjoibXVsdGl0cmFja3MiLCJwb2xpY3kiOiI5V3FJV2tkaHB4VkdLOFBTSVljbkpzY3Z1QTlzeGd1YkxzZCthanVcL2Jva0M5UzIreEFQWVJibWZ6OHRvRUIzOFBkcjNCanh2SHdCdVpQNllLbWNONnR5RUltemtOc0NSNmZZZFJVbzBvYnpVZHVYTXUwMnY5cXpmRDF3c1FpZHRCbXVGVDYzSnNNSk83Q2dsclljMlpEWnlrdHR0UDVtRXp0eTJvWjlnRWlVZGFxQkxROUpubDZWUDJKN0x5WUFXSTZiNWtIN2lHQTFxOFgxNjFRXC9leThaNVB6amQ0YXNnMFFUSWl1MG91bjM3RnNGT28xcmJGXC9xQXNCM2FJRFA3UHNhY0xOVnNpeGxlQkhFelo2VFhFU3pVRXVrTVdJd0dvU3Y3QitXdWFub051SCtEVUYrWWpQck1ORm45NU5cL0N4SXlGOXp0OVJaZU9ENlRwOFA4R2hGSEZUU0lxUlhFT0pHSjE0VGJWekxCN1JqbTNrVmlGSERnbk42NTZLNEt0cTBsbjZLV21kWnE4aGxrTDVFQ1NtQl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lkIjoiREVNTyIsImhhc2giOiJpSGlpQmM3U1QrWTR1T0h1VnVPQVNmNU1nTDVibDJMb1FuNzNHREtcLzltbz0iLCJjaWQiOiJtdWx0aXRyYWNrcyIsInBvbGljeSI6IjlXcUlXa2RocHhWR0s4UFNJWWNuSnNjdnVBOXN4Z3ViTHNkK2FqdVwvYm9tUVpQYnFJK3hhZVlmUW9jY2t2dUVmQWFxZFc1aFhnSk5nY1NTM2ZTN284TnNqd3N6ak11dnQrMFF6TGtaVlZObXgwa2VmT2Uyd0NzMlRJVGdkVTRCdk45YWJoZDByUWtNSXJtb0llb0pIcUllSGNSdlZmNlQxNFJtVEFERXBDWTQ2NHdxamNzWjA0Uk82Zm90Nm5yZjhXSGZ3QVNjek9kV1d6QStFRlRadDhRTWw5SFRueWVYK1g3YXp1Y2VmQjJBd2V0XC9hQm0rZXpmUERodFZuaUhsSiIsInRpbWVzdGFtcCI6IjIwMjItMDgtMDVUMDY6MDM6MjJaIn0="
},
{
"video_codec": "AVC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class DrmMovieController extends SuperController<List<DrmMovie>> {
break;
case PallyConEventType.migrationError:
break;
case PallyConEventType.licenseCipherError:
break;
case PallyConEventType.unknown:
break;
}
Expand Down

0 comments on commit e04ca9f

Please sign in to comment.