@takeoffmedia/react-native-penthera 0.2.33 → 0.2.34
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
CHANGED
|
@@ -35,6 +35,7 @@ import com.bitmovin.player.reactnative.SourceModule
|
|
|
35
35
|
import com.bitmovin.player.reactnative.converter.JsonConverter
|
|
36
36
|
import com.facebook.react.bridge.ReadableMap
|
|
37
37
|
import com.facebook.react.uimanager.UIManagerModule
|
|
38
|
+
import com.facebook.react.bridge.Promise
|
|
38
39
|
|
|
39
40
|
class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
40
41
|
|
|
@@ -43,6 +44,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
43
44
|
|
|
44
45
|
var asset: IAsset? = null
|
|
45
46
|
var assetId: String = ""
|
|
47
|
+
private val gson = Gson()
|
|
46
48
|
|
|
47
49
|
private val enginePauseObserver: Observers.IEngineObserver = object : EngineObserver() {
|
|
48
50
|
override fun engineStatusChanged(status: Int) {
|
|
@@ -104,7 +106,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
104
106
|
|
|
105
107
|
|
|
106
108
|
fun downloadAsset(data: String, activity: Activity) {
|
|
107
|
-
val item =
|
|
109
|
+
val item = gson.fromJson(data, Item::class.java)
|
|
108
110
|
assetId = item.assetId
|
|
109
111
|
val params = MPDAssetBuilder().apply {
|
|
110
112
|
assetId(item.assetId)
|
|
@@ -200,7 +202,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
200
202
|
val keyValueMap = HashMap<String, Any>()
|
|
201
203
|
keyValueMap["offlineUrl"] = offlineUrl
|
|
202
204
|
keyValueMap["metadata"] = asset?.metadata.toString()
|
|
203
|
-
return
|
|
205
|
+
return gson.toJson(keyValueMap)
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
return null
|