@takeoffmedia/react-native-penthera 0.2.66 → 0.2.67
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
|
@@ -334,18 +334,22 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
334
334
|
val subtitles = JSONArray(metadata["subtitles"] as String)
|
|
335
335
|
val ancillaryFiles = JSONArray(ancillaries)
|
|
336
336
|
for (i in 0 until subtitles.length()) {
|
|
337
|
+
val subtitleMap = Arguments.createMap()
|
|
337
338
|
val subtitle = subtitles.getJSONObject(i)
|
|
338
|
-
|
|
339
|
+
|
|
339
340
|
for (j in 0 until ancillaryFiles.length()) {
|
|
340
341
|
val ancillary = ancillaryFiles.getJSONObject(j)
|
|
341
342
|
if(ancillary.getString("description") == subtitle.getString("language")) {
|
|
342
|
-
|
|
343
|
+
subtitleMap.putString("url", ancillary.getString("playbackUrl").toString())
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
subtitleMap.putString("language",subtitle.getString("language"))
|
|
347
|
+
subtitleMap.putString("label",subtitle.getString("label"))
|
|
348
|
+
subtitleMap.putString("format","vtt")
|
|
349
|
+
|
|
350
|
+
JsonConverter.toSubtitleTrack(subtitleMap)?.let {
|
|
351
|
+
sourceItem.addSubtitleTrack(it)
|
|
352
|
+
}
|
|
349
353
|
}
|
|
350
354
|
if(startOffset != null) {
|
|
351
355
|
sourceItem.options.startOffset = startOffset
|