@takeoffmedia/react-native-penthera 0.2.46 → 0.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/takeoffmediareactnativepenthera/AssetQueueObserver.kt +10 -3
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt +30 -29
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/errors/ErrorsMapped.kt +7 -0
- package/ios/Penthera.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Penthera.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/Penthera.xcodeproj/project.xcworkspace/xcuserdata/joseguerreroot.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Penthera.xcodeproj/xcuserdata/joseguerreroot.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +104 -0
- package/ios/Penthera.xcodeproj/xcuserdata/joseguerreroot.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -81,7 +81,7 @@ dependencies {
|
|
|
81
81
|
implementation "com.facebook.react:react-native:+"
|
|
82
82
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
83
83
|
//penthera
|
|
84
|
-
implementation 'com.penthera:cnc-android-sdk-debug:5.3.
|
|
84
|
+
implementation 'com.penthera:cnc-android-sdk-debug:5.3.9'
|
|
85
85
|
implementation 'com.google.code.gson:gson:2.8.6'
|
|
86
86
|
implementation "com.penthera:cnc-android-bitmovin-support:5.3.6-beta"
|
|
87
87
|
|
|
@@ -8,6 +8,7 @@ import com.penthera.virtuososdk.client.IIdentifier
|
|
|
8
8
|
import com.penthera.virtuososdk.client.Observers
|
|
9
9
|
import com.penthera.virtuososdk.client.Virtuoso
|
|
10
10
|
import com.takeoffmediareactnativepenthera.virtuoso.OfflineVideoEngine
|
|
11
|
+
import com.takeoffmediareactnativepenthera.virtuoso.errors.PentheraErrors
|
|
11
12
|
|
|
12
13
|
class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso) : Observers.IQueueObserver {
|
|
13
14
|
|
|
@@ -37,11 +38,17 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
override fun engineEncounteredErrorDownloadingAsset(aAsset: IIdentifier) {
|
|
41
|
+
var asset = aAsset as IAsset
|
|
42
|
+
var limit = asset.assetDownloadLimit
|
|
43
|
+
if(limit == -1 || limit == 0){
|
|
44
|
+
EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.ERROR_DOWNLOAD, asset.assetId, PentheraErrors.DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS)
|
|
45
|
+
}
|
|
40
46
|
Log.e("MiModulo","<<<<<<<<<<engineEncounteredErrorDownloadingAsset>>>>>>>>>>>>")
|
|
41
47
|
// The base implementation does nothing. See class documentation.
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
override fun engineEncounteredErrorParsingAsset(mAssetId: String) {
|
|
51
|
+
var asset = mAssetId
|
|
45
52
|
Log.e("MiModulo","<<<<<<<<<<engineEncounteredErrorParsingAsset>>>>>>>>>>>>")
|
|
46
53
|
}
|
|
47
54
|
|
|
@@ -88,15 +95,15 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
88
95
|
}
|
|
89
96
|
Common.AssetStatus.DOWNLOAD_DENIED_ASSET -> {
|
|
90
97
|
assetStatus = "Queued"
|
|
91
|
-
value = "
|
|
98
|
+
value = ""
|
|
92
99
|
}
|
|
93
100
|
Common.AssetStatus.DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS -> {
|
|
94
101
|
assetStatus = "Queued"
|
|
95
|
-
value =
|
|
102
|
+
value = PentheraErrors.DOWNLOAD_DENIED_ASSET
|
|
96
103
|
}
|
|
97
104
|
Common.AssetStatus.DOWNLOAD_DENIED_COPIES -> {
|
|
98
105
|
assetStatus = "Queued"
|
|
99
|
-
value =
|
|
106
|
+
value = PentheraErrors.DOWNLOAD_DENIED_COPIES
|
|
100
107
|
}
|
|
101
108
|
Common.AssetStatus.DOWNLOAD_COMPLETE -> {
|
|
102
109
|
assetStatus = "complete"
|
package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt
CHANGED
|
@@ -5,7 +5,9 @@ import android.app.Activity
|
|
|
5
5
|
import android.content.Context
|
|
6
6
|
import android.util.Log
|
|
7
7
|
import android.widget.Toast
|
|
8
|
+
import com.bitmovin.player.api.ui.StyleConfig
|
|
8
9
|
import com.bitmovin.player.reactnative.PlayerModule
|
|
10
|
+
import com.bitmovin.player.reactnative.extensions.setProperty
|
|
9
11
|
|
|
10
12
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
11
13
|
import com.google.gson.Gson
|
|
@@ -27,10 +29,9 @@ import com.facebook.react.bridge.Arguments
|
|
|
27
29
|
import com.facebook.react.uimanager.UIManagerModule
|
|
28
30
|
import com.facebook.react.bridge.Promise
|
|
29
31
|
import com.facebook.react.bridge.ReadableArray
|
|
32
|
+
import com.penthera.virtuososdk.client.AncillaryFile
|
|
30
33
|
import org.json.JSONObject
|
|
31
|
-
import java.
|
|
32
|
-
import java.util.Calendar
|
|
33
|
-
import java.util.TimeZone
|
|
34
|
+
import java.util.Arrays
|
|
34
35
|
|
|
35
36
|
class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
36
37
|
|
|
@@ -105,6 +106,27 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
105
106
|
val url = data["url"].toString()
|
|
106
107
|
assetId = item["id"].toString()
|
|
107
108
|
val metadata = item.toString()
|
|
109
|
+
val fileList: MutableList<AncillaryFile> = ArrayList()
|
|
110
|
+
val static = item["static"] as JSONObject
|
|
111
|
+
fileList.add(
|
|
112
|
+
AncillaryFile(
|
|
113
|
+
URL(static["js"] as String),
|
|
114
|
+
"js",
|
|
115
|
+
arrayOf("js"),
|
|
116
|
+
"js",
|
|
117
|
+
URL(url)
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
fileList.add(
|
|
121
|
+
AncillaryFile(
|
|
122
|
+
URL(static["css"] as String),
|
|
123
|
+
"css",
|
|
124
|
+
arrayOf("css"),
|
|
125
|
+
"css",
|
|
126
|
+
URL(url)
|
|
127
|
+
)
|
|
128
|
+
)
|
|
129
|
+
|
|
108
130
|
val params = MPDAssetBuilder().apply {
|
|
109
131
|
assetId(assetId)
|
|
110
132
|
manifestUrl(URL(url))
|
|
@@ -113,12 +135,13 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
113
135
|
desiredVideoBitrate(Int.MAX_VALUE)
|
|
114
136
|
withMetadata(metadata)
|
|
115
137
|
setClientSideAdSupport(true)
|
|
138
|
+
withAncillaryFiles(fileList)
|
|
116
139
|
}.build()
|
|
117
140
|
|
|
118
141
|
virtuoso.assetManager.createMPDSegmentedAssetAsync(params)
|
|
119
142
|
}
|
|
120
143
|
|
|
121
|
-
|
|
144
|
+
fun getDownloads(): String? {
|
|
122
145
|
val completedList = mutableListOf<MutableMap<String, Any>>()
|
|
123
146
|
val cursor = virtuoso.assetManager?.cursor
|
|
124
147
|
val count = cursor?.count
|
|
@@ -131,8 +154,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
131
154
|
while (cursor?.moveToNext() == true && columnNames != null) {
|
|
132
155
|
val assetManager = virtuoso.assetManager
|
|
133
156
|
val dataMap = mutableMapOf<String, Any>()
|
|
134
|
-
var eap = ""
|
|
135
|
-
var ead = ""
|
|
136
157
|
for (columnName in columnNames) {
|
|
137
158
|
val columnIndex = cursor.getColumnIndex(columnName)
|
|
138
159
|
if (columnIndex >= 0) {
|
|
@@ -159,20 +180,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
159
180
|
put("estimatedSize", value)
|
|
160
181
|
}
|
|
161
182
|
}
|
|
162
|
-
if (columnName == "ead") {
|
|
163
|
-
ead = value
|
|
164
|
-
}
|
|
165
|
-
if (columnName == "eap") {
|
|
166
|
-
eap = value
|
|
167
|
-
}
|
|
168
|
-
if (columnName == "firstPlayTime") {
|
|
169
|
-
var eadFormated = dateToString(ead)
|
|
170
|
-
var eapFormated = dateToString(eap)
|
|
171
|
-
dataMap["data"] = (dataMap["data"] as? MutableMap<String, Any> ?: mutableMapOf()).apply {
|
|
172
|
-
put("effectiveExpiryDate", if (value == "0") eadFormated else eapFormated)
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
183
|
}
|
|
177
184
|
}
|
|
178
185
|
dataMap["isCompleted"] = dataMap["currentSize"] == dataMap["expectedSize"]
|
|
@@ -184,15 +191,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
184
191
|
return gson.toJson(completedList)
|
|
185
192
|
}
|
|
186
193
|
|
|
187
|
-
private fun dateToString(seconds: String): String {
|
|
188
|
-
val secondsLong = seconds.toLong()
|
|
189
|
-
val calendar = Calendar.getInstance()
|
|
190
|
-
calendar.add(Calendar.SECOND, secondsLong.toInt())
|
|
191
|
-
|
|
192
|
-
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
|
193
|
-
return dateFormat.format(calendar.time)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
194
|
class AssetParseObserver(activity: Context) : ISegmentedAssetFromParserObserver {
|
|
197
195
|
private val mActivity: Context = activity
|
|
198
196
|
|
|
@@ -244,6 +242,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
244
242
|
val keyValueMap = HashMap<String, Any>()
|
|
245
243
|
keyValueMap["offlineUrl"] = offlineUrl
|
|
246
244
|
keyValueMap["metadata"] = asset?.metadata.toString()
|
|
245
|
+
keyValueMap["ancillary"] = (asset as ISegmentedAsset).getAncillaryFiles(context)
|
|
247
246
|
return gson.toJson(keyValueMap)
|
|
248
247
|
}
|
|
249
248
|
}
|
|
@@ -252,6 +251,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
252
251
|
|
|
253
252
|
fun updateUI() {}
|
|
254
253
|
|
|
254
|
+
|
|
255
255
|
fun loadBitmovinSourceManager(assetId: String, nativeId: String): Boolean {
|
|
256
256
|
virtuoso.assetManager?.getByAssetId(assetId)?.firstOrNull()?.let { asset ->
|
|
257
257
|
val sourceManager = BitmovinSourceManager(context, asset as ISegmentedAsset)
|
|
@@ -259,6 +259,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
259
259
|
val playerModule = context.getNativeModule(PlayerModule::class.java)
|
|
260
260
|
if (playerModule != null && sourceItem != null) {
|
|
261
261
|
val player = playerModule.getPlayer(nativeId)
|
|
262
|
+
|
|
262
263
|
if (player != null) {
|
|
263
264
|
player.load(sourceItem)
|
|
264
265
|
return true
|
package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/errors/ErrorsMapped.kt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
package com.takeoffmediareactnativepenthera.virtuoso.errors
|
|
2
|
+
|
|
3
|
+
object PentheraErrors {
|
|
4
|
+
const val DOWNLOAD_DENIED_ASSET = "The asset has already been downloaded as many times as permitted. To download this asset again, administrative action is required."
|
|
5
|
+
const val DOWNLOAD_DENIED_COPIES = "There are already as many downloaded copies of this asset as permitted on this account. To continue downloading, the user must delete a copy of this asset from one of their devices."
|
|
6
|
+
const val DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS = "There are already as many downloads as permitted on this account. To continue downloading, the user must delete downloaded assets from one of their devices."
|
|
7
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Bucket
|
|
3
|
+
uuid = "3AE98629-7421-4561-B12C-C06B8B6A3023"
|
|
4
|
+
type = "1"
|
|
5
|
+
version = "2.0">
|
|
6
|
+
<Breakpoints>
|
|
7
|
+
<BreakpointProxy
|
|
8
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
9
|
+
<BreakpointContent
|
|
10
|
+
uuid = "A5D166B0-3C57-4F4D-A845-BDB81498DA0F"
|
|
11
|
+
shouldBeEnabled = "No"
|
|
12
|
+
ignoreCount = "0"
|
|
13
|
+
continueAfterRunningActions = "No"
|
|
14
|
+
filePath = "Penthera.swift"
|
|
15
|
+
startingColumnNumber = "9223372036854775807"
|
|
16
|
+
endingColumnNumber = "9223372036854775807"
|
|
17
|
+
startingLineNumber = "18"
|
|
18
|
+
endingLineNumber = "18"
|
|
19
|
+
landmarkName = "Penthera"
|
|
20
|
+
landmarkType = "3">
|
|
21
|
+
</BreakpointContent>
|
|
22
|
+
</BreakpointProxy>
|
|
23
|
+
<BreakpointProxy
|
|
24
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
25
|
+
<BreakpointContent
|
|
26
|
+
uuid = "5D7AE47B-D5FC-4468-A75B-C414F3F8A58C"
|
|
27
|
+
shouldBeEnabled = "No"
|
|
28
|
+
ignoreCount = "0"
|
|
29
|
+
continueAfterRunningActions = "No"
|
|
30
|
+
filePath = "Penthera.swift"
|
|
31
|
+
startingColumnNumber = "9223372036854775807"
|
|
32
|
+
endingColumnNumber = "9223372036854775807"
|
|
33
|
+
startingLineNumber = "25"
|
|
34
|
+
endingLineNumber = "25"
|
|
35
|
+
landmarkName = "updateStatusInfo()"
|
|
36
|
+
landmarkType = "7">
|
|
37
|
+
</BreakpointContent>
|
|
38
|
+
</BreakpointProxy>
|
|
39
|
+
<BreakpointProxy
|
|
40
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
41
|
+
<BreakpointContent
|
|
42
|
+
uuid = "E3C50B30-46CF-4D56-8C49-C257C70E0ACC"
|
|
43
|
+
shouldBeEnabled = "No"
|
|
44
|
+
ignoreCount = "0"
|
|
45
|
+
continueAfterRunningActions = "No"
|
|
46
|
+
filePath = "Penthera.swift"
|
|
47
|
+
startingColumnNumber = "9223372036854775807"
|
|
48
|
+
endingColumnNumber = "9223372036854775807"
|
|
49
|
+
startingLineNumber = "26"
|
|
50
|
+
endingLineNumber = "26"
|
|
51
|
+
landmarkName = "updateStatusInfo()"
|
|
52
|
+
landmarkType = "7">
|
|
53
|
+
</BreakpointContent>
|
|
54
|
+
</BreakpointProxy>
|
|
55
|
+
<BreakpointProxy
|
|
56
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
57
|
+
<BreakpointContent
|
|
58
|
+
uuid = "75EF43BF-56FF-4727-B372-E1A0EBC02C61"
|
|
59
|
+
shouldBeEnabled = "Yes"
|
|
60
|
+
ignoreCount = "0"
|
|
61
|
+
continueAfterRunningActions = "No"
|
|
62
|
+
filePath = "Penthera.swift"
|
|
63
|
+
startingColumnNumber = "9223372036854775807"
|
|
64
|
+
endingColumnNumber = "9223372036854775807"
|
|
65
|
+
startingLineNumber = "101"
|
|
66
|
+
endingLineNumber = "101"
|
|
67
|
+
landmarkName = "initializeSdk(user:backplaneUrl:publicKey:privateKey:resolve:reject:)"
|
|
68
|
+
landmarkType = "7">
|
|
69
|
+
</BreakpointContent>
|
|
70
|
+
</BreakpointProxy>
|
|
71
|
+
<BreakpointProxy
|
|
72
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
73
|
+
<BreakpointContent
|
|
74
|
+
uuid = "EF36B51B-4FC2-4989-A791-180E3212EFE3"
|
|
75
|
+
shouldBeEnabled = "Yes"
|
|
76
|
+
ignoreCount = "0"
|
|
77
|
+
continueAfterRunningActions = "No"
|
|
78
|
+
filePath = "Penthera.swift"
|
|
79
|
+
startingColumnNumber = "9223372036854775807"
|
|
80
|
+
endingColumnNumber = "9223372036854775807"
|
|
81
|
+
startingLineNumber = "149"
|
|
82
|
+
endingLineNumber = "149"
|
|
83
|
+
landmarkName = "getDownloadedAsset(assetID:)"
|
|
84
|
+
landmarkType = "7">
|
|
85
|
+
</BreakpointContent>
|
|
86
|
+
</BreakpointProxy>
|
|
87
|
+
<BreakpointProxy
|
|
88
|
+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
89
|
+
<BreakpointContent
|
|
90
|
+
uuid = "C467C00E-2428-4D24-843A-E7CDF28CB553"
|
|
91
|
+
shouldBeEnabled = "Yes"
|
|
92
|
+
ignoreCount = "0"
|
|
93
|
+
continueAfterRunningActions = "No"
|
|
94
|
+
filePath = "Penthera.swift"
|
|
95
|
+
startingColumnNumber = "9223372036854775807"
|
|
96
|
+
endingColumnNumber = "9223372036854775807"
|
|
97
|
+
startingLineNumber = "148"
|
|
98
|
+
endingLineNumber = "148"
|
|
99
|
+
landmarkName = "getDownloadedAsset(assetID:)"
|
|
100
|
+
landmarkType = "7">
|
|
101
|
+
</BreakpointContent>
|
|
102
|
+
</BreakpointProxy>
|
|
103
|
+
</Breakpoints>
|
|
104
|
+
</Bucket>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Penthera.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|