@takeoffmedia/react-native-penthera 0.2.43 → 0.2.46
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/src/main/java/com/takeoffmediareactnativepenthera/AssetQueueObserver.kt +7 -16
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt +30 -5
- package/package.json +1 -1
- package/ios/Penthera.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/Penthera.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/Penthera.xcodeproj/project.xcworkspace/xcuserdata/joseguerreroot.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Penthera.xcodeproj/xcuserdata/joseguerreroot.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -104
- package/ios/Penthera.xcodeproj/xcuserdata/joseguerreroot.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
@@ -49,21 +49,6 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
49
49
|
// This indicates a change to the download queue - meaning either we added or removed something
|
|
50
50
|
Log.e("MiModulo","<<<<<<<<<<engineUpdatedQueue>>>>>>>>>>>>")
|
|
51
51
|
|
|
52
|
-
val assetManager: IAssetManager = mOfflineVideo.virtuoso!!.assetManager
|
|
53
|
-
val queued = assetManager.queue.size()
|
|
54
|
-
val downloaded = assetManager.downloaded.cursor.count
|
|
55
|
-
val curAsset = mOfflineVideo.asset
|
|
56
|
-
if (curAsset != null && (queued > 0 || downloaded > 0)) {
|
|
57
|
-
val asset = assetManager.get(curAsset.id) as IAsset
|
|
58
|
-
if (asset.downloadStatus != curAsset.downloadStatus) {
|
|
59
|
-
mOfflineVideo.asset = asset
|
|
60
|
-
updateItem(asset, true)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (queued == 0) {
|
|
64
|
-
// The asset has been deleted or downloaded
|
|
65
|
-
Log.e("MiModulo","<<<<<<<<<<Asset deleted>>>>>>>>>>>>")
|
|
66
|
-
}
|
|
67
52
|
}
|
|
68
53
|
|
|
69
54
|
private fun updateItem(aFile: IIdentifier, forceUpdate: Boolean) {
|
|
@@ -96,6 +81,7 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
96
81
|
val status = asset.downloadStatus
|
|
97
82
|
val allowableStorageRemaining = istanceVirtuoso.allowableStorageRemaining
|
|
98
83
|
when (status) {
|
|
84
|
+
|
|
99
85
|
Common.AssetStatus.DOWNLOADING -> {
|
|
100
86
|
assetStatus = "Downloading"
|
|
101
87
|
value = "downloading"
|
|
@@ -112,6 +98,10 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
112
98
|
assetStatus = "Queued"
|
|
113
99
|
value = "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."
|
|
114
100
|
}
|
|
101
|
+
Common.AssetStatus.DOWNLOAD_COMPLETE -> {
|
|
102
|
+
assetStatus = "complete"
|
|
103
|
+
value = "complete"
|
|
104
|
+
}
|
|
115
105
|
else -> {
|
|
116
106
|
if(allowableStorageRemaining == 0L) {
|
|
117
107
|
assetStatus = "Queued"
|
|
@@ -122,7 +112,8 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
122
112
|
}
|
|
123
113
|
}
|
|
124
114
|
}
|
|
125
|
-
|
|
115
|
+
val hasError = assetStatus !== "Downloading" && assetStatus !== "complete"
|
|
116
|
+
if(hasError){
|
|
126
117
|
EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.ERROR_DOWNLOAD, it.assetId, value)
|
|
127
118
|
}
|
|
128
119
|
}
|
package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt
CHANGED
|
@@ -28,6 +28,9 @@ import com.facebook.react.uimanager.UIManagerModule
|
|
|
28
28
|
import com.facebook.react.bridge.Promise
|
|
29
29
|
import com.facebook.react.bridge.ReadableArray
|
|
30
30
|
import org.json.JSONObject
|
|
31
|
+
import java.text.SimpleDateFormat
|
|
32
|
+
import java.util.Calendar
|
|
33
|
+
import java.util.TimeZone
|
|
31
34
|
|
|
32
35
|
class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
33
36
|
|
|
@@ -101,17 +104,14 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
101
104
|
val item = data["item"] as JSONObject
|
|
102
105
|
val url = data["url"].toString()
|
|
103
106
|
assetId = item["id"].toString()
|
|
104
|
-
|
|
105
|
-
var metadata = item["data"]
|
|
106
|
-
(metadata as JSONObject).put("drmContent", item["drmContent"])
|
|
107
|
-
metadata = metadata.toString()
|
|
107
|
+
val metadata = item.toString()
|
|
108
108
|
val params = MPDAssetBuilder().apply {
|
|
109
109
|
assetId(assetId)
|
|
110
110
|
manifestUrl(URL(url))
|
|
111
111
|
assetObserver(AssetParseObserver(context))
|
|
112
112
|
addToQueue(true)
|
|
113
113
|
desiredVideoBitrate(Int.MAX_VALUE)
|
|
114
|
-
|
|
114
|
+
withMetadata(metadata)
|
|
115
115
|
setClientSideAdSupport(true)
|
|
116
116
|
}.build()
|
|
117
117
|
|
|
@@ -131,6 +131,8 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
131
131
|
while (cursor?.moveToNext() == true && columnNames != null) {
|
|
132
132
|
val assetManager = virtuoso.assetManager
|
|
133
133
|
val dataMap = mutableMapOf<String, Any>()
|
|
134
|
+
var eap = ""
|
|
135
|
+
var ead = ""
|
|
134
136
|
for (columnName in columnNames) {
|
|
135
137
|
val columnIndex = cursor.getColumnIndex(columnName)
|
|
136
138
|
if (columnIndex >= 0) {
|
|
@@ -157,6 +159,20 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
157
159
|
put("estimatedSize", value)
|
|
158
160
|
}
|
|
159
161
|
}
|
|
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
|
+
|
|
160
176
|
}
|
|
161
177
|
}
|
|
162
178
|
dataMap["isCompleted"] = dataMap["currentSize"] == dataMap["expectedSize"]
|
|
@@ -168,6 +184,15 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
168
184
|
return gson.toJson(completedList)
|
|
169
185
|
}
|
|
170
186
|
|
|
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
|
+
|
|
171
196
|
class AssetParseObserver(activity: Context) : ISegmentedAssetFromParserObserver {
|
|
172
197
|
private val mActivity: Context = activity
|
|
173
198
|
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,104 +0,0 @@
|
|
|
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>
|
|
@@ -1,14 +0,0 @@
|
|
|
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>
|