@takeoffmedia/react-native-penthera 0.2.43 → 0.2.45

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.
@@ -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
- if(assetStatus !== "Downloading"){
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
  }
@@ -101,17 +101,14 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
101
101
  val item = data["item"] as JSONObject
102
102
  val url = data["url"].toString()
103
103
  assetId = item["id"].toString()
104
-
105
- var metadata = item["data"]
106
- (metadata as JSONObject).put("drmContent", item["drmContent"])
107
- metadata = metadata.toString()
104
+ val metadata = item.toString()
108
105
  val params = MPDAssetBuilder().apply {
109
106
  assetId(assetId)
110
107
  manifestUrl(URL(url))
111
108
  assetObserver(AssetParseObserver(context))
112
109
  addToQueue(true)
113
110
  desiredVideoBitrate(Int.MAX_VALUE)
114
- withMetadata(metadata)
111
+ withMetadata(metadata)
115
112
  setClientSideAdSupport(true)
116
113
  }.build()
117
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",