@takeoffmedia/react-native-penthera 0.2.64 → 0.2.66
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/virtuoso/OfflineVideoEngine.kt +16 -20
- 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/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt
CHANGED
|
@@ -29,17 +29,18 @@ import com.facebook.react.uimanager.UIManagerModule
|
|
|
29
29
|
import com.facebook.react.bridge.Promise
|
|
30
30
|
import com.facebook.react.bridge.ReadableArray
|
|
31
31
|
import com.penthera.virtuososdk.client.AncillaryFile
|
|
32
|
+
import okhttp3.OkHttpClient
|
|
33
|
+
import okhttp3.Request
|
|
32
34
|
import org.json.JSONArray
|
|
33
35
|
import org.json.JSONObject
|
|
36
|
+
import java.io.IOException
|
|
34
37
|
import java.net.HttpURLConnection
|
|
35
38
|
import java.text.SimpleDateFormat
|
|
36
39
|
import java.util.Calendar
|
|
37
40
|
|
|
38
41
|
class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
39
|
-
|
|
40
42
|
lateinit var virtuoso : Virtuoso
|
|
41
43
|
private lateinit var queueObserver: AssetQueueObserver
|
|
42
|
-
|
|
43
44
|
var asset: IAsset? = null
|
|
44
45
|
var assetId: MutableList<String> = mutableListOf()
|
|
45
46
|
private val gson = Gson()
|
|
@@ -48,6 +49,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
48
49
|
var valueBackPlaneUrl: String = ""
|
|
49
50
|
var valuePublicKey: String = ""
|
|
50
51
|
var valuePrivateKey: String = ""
|
|
52
|
+
private val client = OkHttpClient()
|
|
51
53
|
|
|
52
54
|
private val enginePauseObserver: Observers.IEngineObserver = object : EngineObserver() {
|
|
53
55
|
override fun engineStatusChanged(status: Int) {
|
|
@@ -176,8 +178,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
176
178
|
return gson.toJson(completedList)
|
|
177
179
|
}
|
|
178
180
|
val columnNames = cursor?.columnNames
|
|
179
|
-
|
|
180
|
-
while (cursor?.moveToNext() == true && columnNames != null) {
|
|
181
|
+
while (cursor?.moveToNext() == true && columnNames != null) {
|
|
181
182
|
val dataMap = mutableMapOf<String, Any>()
|
|
182
183
|
var eap = ""
|
|
183
184
|
var ead = ""
|
|
@@ -225,7 +226,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
225
226
|
put("effectiveExpiryDate", if (value == "0") eadFormated else eapFormated)
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
|
-
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
dataMap["isPaused"] = false
|
|
@@ -272,7 +272,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
272
272
|
val idValue = assetIds.getString(i)
|
|
273
273
|
val asset = assetManager.getByAssetId(idValue)
|
|
274
274
|
.firstOrNull() as? IAsset
|
|
275
|
-
|
|
276
275
|
if (asset != null) {
|
|
277
276
|
assetManager.delete(asset)
|
|
278
277
|
result.putBoolean(idValue, true)
|
|
@@ -289,13 +288,21 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
289
288
|
|
|
290
289
|
fun getByAssetId(assetId: String): String? {
|
|
291
290
|
//load asset if it has already been downloaded
|
|
292
|
-
val list: MutableList<IIdentifier>? =
|
|
291
|
+
val list: MutableList<IIdentifier>? = getInstanceVirtuoso().assetManager.getByAssetId(assetId)
|
|
293
292
|
|
|
294
293
|
list?.let {
|
|
295
294
|
if (it.isNotEmpty()) {
|
|
296
295
|
asset = list[0] as VirtuosoSegmentedFile
|
|
296
|
+
|
|
297
|
+
// This a workaound to works ancillary files
|
|
297
298
|
val offlineUrl = asset?.playbackURL
|
|
298
|
-
|
|
299
|
+
val request = Request.Builder()
|
|
300
|
+
.url(offlineUrl.toString())
|
|
301
|
+
.build()
|
|
302
|
+
client.newCall(request).execute().use { response ->
|
|
303
|
+
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
|
304
|
+
}
|
|
305
|
+
|
|
299
306
|
val keyValueMap = HashMap<String, Any>()
|
|
300
307
|
keyValueMap["offlineUrl"] = offlineUrl.toString()
|
|
301
308
|
keyValueMap["metadata"] = asset?.metadata.toString()
|
|
@@ -309,33 +316,26 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
309
316
|
}
|
|
310
317
|
return null
|
|
311
318
|
}
|
|
312
|
-
|
|
313
319
|
fun updateUI() {}
|
|
314
320
|
|
|
315
321
|
fun loadBitmovinSourceManager(assetId: String, nativeId: String, startOffset: Double?, ancillaries: String , promise: Promise) {
|
|
316
|
-
|
|
317
|
-
virtuoso.assetManager?.getByAssetId(assetId)?.firstOrNull()?.let { asset ->
|
|
318
|
-
|
|
322
|
+
getInstanceVirtuoso().assetManager?.getByAssetId(assetId)?.firstOrNull()?.let { asset ->
|
|
319
323
|
val sourceManager = BitmovinSourceManager(context, asset as ISegmentedAsset)
|
|
320
324
|
val sourceItem = sourceManager.bitmovinSourceItem
|
|
321
325
|
val playerModule = context.getNativeModule(PlayerModule::class.java)
|
|
322
326
|
if (playerModule != null && sourceItem != null) {
|
|
323
|
-
|
|
324
327
|
var player = playerModule.getPlayer(nativeId)
|
|
325
328
|
while(player == null) {
|
|
326
329
|
Thread.sleep(100)
|
|
327
330
|
player = playerModule.getPlayer(nativeId) as Nothing?
|
|
328
331
|
}
|
|
329
|
-
|
|
330
332
|
if (player != null) {
|
|
331
333
|
val metadata = JSONObject(asset.metadata)
|
|
332
334
|
val subtitles = JSONArray(metadata["subtitles"] as String)
|
|
333
335
|
val ancillaryFiles = JSONArray(ancillaries)
|
|
334
336
|
for (i in 0 until subtitles.length()) {
|
|
335
337
|
val subtitle = subtitles.getJSONObject(i)
|
|
336
|
-
|
|
337
338
|
var url: String = ""
|
|
338
|
-
|
|
339
339
|
for (j in 0 until ancillaryFiles.length()) {
|
|
340
340
|
val ancillary = ancillaryFiles.getJSONObject(j)
|
|
341
341
|
if(ancillary.getString("description") == subtitle.getString("language")) {
|
|
@@ -346,13 +346,10 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
346
346
|
val label: String = subtitle.getString("label")
|
|
347
347
|
val format = "vtt"
|
|
348
348
|
sourceItem.addSubtitleTrack(SubtitleTrack(url, language, label, format))
|
|
349
|
-
|
|
350
349
|
}
|
|
351
|
-
|
|
352
350
|
if(startOffset != null) {
|
|
353
351
|
sourceItem.options.startOffset = startOffset
|
|
354
352
|
}
|
|
355
|
-
|
|
356
353
|
player.load(sourceItem)
|
|
357
354
|
promise.resolve(true)
|
|
358
355
|
}
|
|
@@ -364,5 +361,4 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
364
361
|
private fun uiManager(): UIManagerModule? =
|
|
365
362
|
context.getNativeModule(UIManagerModule::class.java)
|
|
366
363
|
|
|
367
|
-
|
|
368
364
|
}
|
|
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>
|