@takeoffmedia/react-native-penthera 0.2.36 → 0.2.38
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/PentheraModule.kt +10 -8
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt +40 -34
- package/package.json +2 -2
- 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
|
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
9
9
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
10
10
|
import com.facebook.react.bridge.ReactMethod
|
|
11
11
|
import com.facebook.react.bridge.Promise
|
|
12
|
+
import com.facebook.react.bridge.ReadableArray
|
|
12
13
|
import com.facebook.react.bridge.ReadableMap
|
|
13
14
|
import com.facebook.react.bridge.WritableMap
|
|
14
15
|
import com.takeoffmediareactnativepenthera.virtuoso.OfflineVideoEngine
|
|
@@ -17,7 +18,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEm
|
|
|
17
18
|
|
|
18
19
|
class PentheraModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
19
20
|
|
|
20
|
-
private var offlineVideoEngine: OfflineVideoEngine
|
|
21
|
+
private var offlineVideoEngine: OfflineVideoEngine = OfflineVideoEngine(reactContext)
|
|
21
22
|
private var activity: Activity? = null
|
|
22
23
|
private var appState: String = "active"
|
|
23
24
|
val reactContext: ReactApplicationContext = reactContext
|
|
@@ -48,21 +49,22 @@ class PentheraModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
|
|
|
48
49
|
}
|
|
49
50
|
@ReactMethod
|
|
50
51
|
fun getDownloads(blank: String, promise: Promise) {
|
|
51
|
-
promise.resolve(offlineVideoEngine
|
|
52
|
+
promise.resolve(offlineVideoEngine.getDownloads())
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
@ReactMethod
|
|
55
56
|
fun getByAssetId(assetId: String, promise: Promise) {
|
|
56
|
-
promise.resolve(offlineVideoEngine
|
|
57
|
+
promise.resolve(offlineVideoEngine.getByAssetId(assetId))
|
|
57
58
|
}
|
|
58
59
|
@ReactMethod
|
|
59
|
-
fun
|
|
60
|
-
offlineVideoEngine
|
|
60
|
+
fun deleteMany(assetIds: ReadableArray, promise: Promise) {
|
|
61
|
+
val result = offlineVideoEngine.deleteMany(assetIds, promise)
|
|
62
|
+
promise.resolve(result)
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
@ReactMethod
|
|
64
66
|
fun loadBitmovinSourceManager(assetId: String, nativeId: String, promise: Promise) {
|
|
65
|
-
val bitmovinSourceItem = offlineVideoEngine
|
|
67
|
+
val bitmovinSourceItem = offlineVideoEngine.loadBitmovinSourceManager(assetId, nativeId)
|
|
66
68
|
promise.resolve(bitmovinSourceItem)
|
|
67
69
|
}
|
|
68
70
|
@ReactMethod
|
|
@@ -79,7 +81,7 @@ class PentheraModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
|
|
|
79
81
|
|
|
80
82
|
reactContext.addLifecycleEventListener(object : LifecycleEventListener {
|
|
81
83
|
override fun onHostResume() {
|
|
82
|
-
offlineVideoEngine
|
|
84
|
+
offlineVideoEngine.onResume()
|
|
83
85
|
appStateListener("active")
|
|
84
86
|
|
|
85
87
|
}
|
|
@@ -87,7 +89,7 @@ class PentheraModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
|
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
override fun onHostPause() {
|
|
90
|
-
offlineVideoEngine
|
|
92
|
+
offlineVideoEngine.onPause()
|
|
91
93
|
appStateListener("background")
|
|
92
94
|
}
|
|
93
95
|
|
package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt
CHANGED
|
@@ -33,13 +33,16 @@ import java.net.URL
|
|
|
33
33
|
import java.util.UUID
|
|
34
34
|
import com.bitmovin.player.reactnative.SourceModule
|
|
35
35
|
import com.bitmovin.player.reactnative.converter.JsonConverter
|
|
36
|
+
import com.facebook.react.bridge.Arguments
|
|
36
37
|
import com.facebook.react.bridge.ReadableMap
|
|
37
38
|
import com.facebook.react.uimanager.UIManagerModule
|
|
38
39
|
import com.facebook.react.bridge.Promise
|
|
40
|
+
import com.facebook.react.bridge.ReadableArray
|
|
41
|
+
import com.facebook.react.bridge.WritableMap
|
|
39
42
|
|
|
40
43
|
class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
41
44
|
|
|
42
|
-
var
|
|
45
|
+
lateinit var virtuoso : Virtuoso
|
|
43
46
|
private lateinit var queueObserver: AssetQueueObserver
|
|
44
47
|
|
|
45
48
|
var asset: IAsset? = null
|
|
@@ -56,38 +59,38 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
56
59
|
virtuoso = Virtuoso(context)
|
|
57
60
|
queueObserver = AssetQueueObserver(this)
|
|
58
61
|
onResume()
|
|
59
|
-
return virtuoso
|
|
62
|
+
return virtuoso
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
fun onResume() {
|
|
63
|
-
virtuoso
|
|
64
|
-
virtuoso
|
|
65
|
-
virtuoso
|
|
66
|
+
virtuoso.onResume()
|
|
67
|
+
virtuoso.addObserver(queueObserver)
|
|
68
|
+
virtuoso.addObserver(enginePauseObserver)
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
fun onPause() {
|
|
69
|
-
virtuoso
|
|
70
|
-
virtuoso
|
|
71
|
-
virtuoso
|
|
72
|
+
virtuoso.onPause()
|
|
73
|
+
virtuoso.removeObserver(queueObserver)
|
|
74
|
+
virtuoso.removeObserver(enginePauseObserver)
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
fun setup(
|
|
75
|
-
|
|
78
|
+
userId: String,
|
|
76
79
|
backplaneUrl: String,
|
|
77
80
|
publicKey: String,
|
|
78
81
|
privateKey: String,
|
|
79
82
|
activity: Activity,
|
|
80
83
|
promise: Promise,
|
|
81
|
-
)
|
|
84
|
+
) {
|
|
82
85
|
val backplane = getVirtuoso(activity)
|
|
83
86
|
val status = backplane.backplane?.authenticationStatus
|
|
87
|
+
val nameDevice = android.os.Build.MODEL
|
|
84
88
|
if (status == AuthenticationStatus.NOT_AUTHENTICATED) {
|
|
85
|
-
virtuoso
|
|
86
|
-
URL(backplaneUrl)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
publicKey,//Penthera demo public key. Substitute the correct one.
|
|
89
|
+
virtuoso.startup(
|
|
90
|
+
URL(backplaneUrl),
|
|
91
|
+
userId,
|
|
92
|
+
nameDevice,
|
|
93
|
+
publicKey,
|
|
91
94
|
privateKey,
|
|
92
95
|
object : IPushRegistrationObserver {
|
|
93
96
|
override fun onServiceAvailabilityResponse(
|
|
@@ -117,12 +120,12 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
117
120
|
setClientSideAdSupport(true)
|
|
118
121
|
}.build()
|
|
119
122
|
|
|
120
|
-
virtuoso
|
|
123
|
+
virtuoso.assetManager.createMPDSegmentedAssetAsync(params)
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
fun getDownloads(): String? {
|
|
124
127
|
val completedList = mutableListOf<MutableMap<String, Any>>()
|
|
125
|
-
val cursor = virtuoso
|
|
128
|
+
val cursor = virtuoso.assetManager?.cursor
|
|
126
129
|
val count = cursor?.count
|
|
127
130
|
if( count == 0){
|
|
128
131
|
cursor.close()
|
|
@@ -171,28 +174,31 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
fun deleteAsset(assetId: String) {
|
|
175
|
-
//load asset if it has already been downloaded
|
|
176
|
-
val list: MutableList<IIdentifier>? = virtuoso?.assetManager?.getByAssetId(assetId)
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
fun deleteMany(assetIds: ReadableArray, promise: Promise) {
|
|
179
|
+
val assetManager = virtuoso.assetManager
|
|
180
|
+
val result = Arguments.createMap()
|
|
181
|
+
|
|
182
|
+
for (i in 0 until assetIds.size()) {
|
|
183
|
+
val assetId = assetIds.getString(i)
|
|
184
|
+
val asset = assetManager.getByAssetId(assetId)
|
|
185
|
+
.firstOrNull() as? IAsset
|
|
186
|
+
|
|
187
|
+
if (asset != null) {
|
|
188
|
+
assetManager.delete(asset)
|
|
189
|
+
result.putBoolean(assetId, true)
|
|
190
|
+
} else {
|
|
191
|
+
result.putBoolean(assetId, false)
|
|
192
|
+
}
|
|
189
193
|
}
|
|
190
194
|
|
|
195
|
+
promise.resolve(result);
|
|
191
196
|
}
|
|
192
197
|
|
|
198
|
+
|
|
193
199
|
fun getByAssetId(assetId: String): String? {
|
|
194
200
|
//load asset if it has already been downloaded
|
|
195
|
-
val list: MutableList<IIdentifier>? = virtuoso
|
|
201
|
+
val list: MutableList<IIdentifier>? = virtuoso.assetManager.getByAssetId(assetId)
|
|
196
202
|
|
|
197
203
|
list?.let {
|
|
198
204
|
if (it.isNotEmpty()) {
|
|
@@ -210,7 +216,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
210
216
|
fun updateUI() {}
|
|
211
217
|
|
|
212
218
|
fun loadBitmovinSourceManager(assetId: String, nativeId: String): Boolean {
|
|
213
|
-
virtuoso
|
|
219
|
+
virtuoso.assetManager?.getByAssetId(assetId)?.firstOrNull()?.let { asset ->
|
|
214
220
|
val sourceManager = BitmovinSourceManager(context, asset as ISegmentedAsset)
|
|
215
221
|
val sourceItem = sourceManager.bitmovinSourceItem
|
|
216
222
|
val playerModule = context.getNativeModule(PlayerModule::class.java)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeoffmedia/react-native-penthera",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"description": "test",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -166,4 +166,4 @@
|
|
|
166
166
|
"dependencies": {
|
|
167
167
|
"zustand": "^4.4.0"
|
|
168
168
|
}
|
|
169
|
-
}
|
|
169
|
+
}
|
|
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>
|