@takeoffmedia/react-native-penthera 0.2.47 → 0.2.49

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.
@@ -81,7 +81,7 @@ dependencies {
81
81
  implementation "com.facebook.react:react-native:+"
82
82
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
83
83
  //penthera
84
- implementation 'com.penthera:cnc-android-sdk-debug:5.3.5'
84
+ implementation 'com.penthera:cnc-android-sdk-debug:5.3.9'
85
85
  implementation 'com.google.code.gson:gson:2.8.6'
86
86
  implementation "com.penthera:cnc-android-bitmovin-support:5.3.6-beta"
87
87
 
@@ -27,6 +27,7 @@ import com.facebook.react.bridge.Arguments
27
27
  import com.facebook.react.uimanager.UIManagerModule
28
28
  import com.facebook.react.bridge.Promise
29
29
  import com.facebook.react.bridge.ReadableArray
30
+ import com.penthera.virtuososdk.client.AncillaryFile
30
31
  import org.json.JSONObject
31
32
  import java.text.SimpleDateFormat
32
33
  import java.util.Calendar
@@ -105,6 +106,27 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
105
106
  val url = data["url"].toString()
106
107
  assetId = item["id"].toString()
107
108
  val metadata = item.toString()
109
+ val fileList: MutableList<AncillaryFile> = ArrayList()
110
+ val static = item["static"] as JSONObject
111
+ fileList.add(
112
+ AncillaryFile(
113
+ URL(static["js"] as String),
114
+ "js",
115
+ arrayOf("js"),
116
+ "js",
117
+ URL(url)
118
+ )
119
+ )
120
+ fileList.add(
121
+ AncillaryFile(
122
+ URL(static["css"] as String),
123
+ "css",
124
+ arrayOf("css"),
125
+ "css",
126
+ URL(url)
127
+ )
128
+ )
129
+
108
130
  val params = MPDAssetBuilder().apply {
109
131
  assetId(assetId)
110
132
  manifestUrl(URL(url))
@@ -113,12 +135,13 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
113
135
  desiredVideoBitrate(Int.MAX_VALUE)
114
136
  withMetadata(metadata)
115
137
  setClientSideAdSupport(true)
138
+ withAncillaryFiles(fileList)
116
139
  }.build()
117
140
 
118
141
  virtuoso.assetManager.createMPDSegmentedAssetAsync(params)
119
142
  }
120
143
 
121
- fun getDownloads(): String? {
144
+ fun getDownloads(): String? {
122
145
  val completedList = mutableListOf<MutableMap<String, Any>>()
123
146
  val cursor = virtuoso.assetManager?.cursor
124
147
  val count = cursor?.count
@@ -198,16 +221,16 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
198
221
 
199
222
  @SuppressLint("ShowToast")
200
223
  override fun complete(asset: ISegmentedAsset?, error: Int, addedToQueue: Boolean) {
201
-
202
- if (asset != null) {
203
- Toast.makeText(
204
- mActivity,
205
- "Asset parsed and " + if (addedToQueue) "added" else "not added" + "to download queue",
206
- Toast.LENGTH_LONG
207
- ).show()
208
- } else {
209
- Toast.makeText(mActivity, "Error $error while parsing asset", Toast.LENGTH_LONG).show()
210
- }
224
+ // Show a process when the asset to parsed and added to queue
225
+ // if (asset != null) {
226
+ // Toast.makeText(
227
+ // mActivity,
228
+ // "Asset parsed and " + if (addedToQueue) "added" else "not added" + "to download queue",
229
+ // Toast.LENGTH_LONG
230
+ // ).show()
231
+ // } else {
232
+ // Toast.makeText(mActivity, "Error $error while parsing asset", Toast.LENGTH_LONG).show()
233
+ // }
211
234
  }
212
235
  }
213
236
 
@@ -244,6 +267,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
244
267
  val keyValueMap = HashMap<String, Any>()
245
268
  keyValueMap["offlineUrl"] = offlineUrl
246
269
  keyValueMap["metadata"] = asset?.metadata.toString()
270
+ keyValueMap["ancillary"] = (asset as ISegmentedAsset).getAncillaryFiles(context)
247
271
  return gson.toJson(keyValueMap)
248
272
  }
249
273
  }
@@ -27,7 +27,8 @@ class ServiceStarter : VirtuosoServiceStarter() {
27
27
  }
28
28
 
29
29
  // This is a helper class which is used in the demo for creating the notifications
30
- private val notificationFactory: NotificationFactory = NotificationFactory("PentheraExample")
30
+ //Name notification channel
31
+ private val notificationFactory: NotificationFactory = NotificationFactory("Britbox")
31
32
 
32
33
  /**
33
34
  * This method will be called by the framework to request the generation of a notification,
@@ -62,4 +63,4 @@ class ServiceStarter : VirtuosoServiceStarter() {
62
63
  return ServiceForegroundNotificationProvider::class.java
63
64
  }
64
65
 
65
- }
66
+ }
@@ -91,8 +91,9 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
91
91
  override fun getForegroundServiceNotification(context: Context?, file: IAsset?, reasonIntent: Intent?): Notification {
92
92
  if (reasonIntent == null) return currentNotification!!
93
93
 
94
- currentNotification = NotificationFactory("PentheraExample").getNotification(context!!, reasonIntent )
94
+ //Name notification channel
95
+ currentNotification = NotificationFactory("Britbox").getNotification(context!!, reasonIntent )
95
96
 
96
97
  return currentNotification!!
97
98
  }
98
- }
99
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.2.47",
3
+ "version": "0.2.49",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",