capacitor-plugin-playlist 0.2.0 → 0.2.1
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.
|
@@ -22,6 +22,7 @@ class App : Application() {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
override fun onCreate() {
|
|
25
|
+
resetPlaylistManager()
|
|
25
26
|
super.onCreate()
|
|
26
27
|
|
|
27
28
|
configureExoMedia()
|
|
@@ -33,14 +34,25 @@ class App : Application() {
|
|
|
33
34
|
ExoMedia.setDataSourceFactoryProvider(object : ExoMedia.DataSourceFactoryProvider {
|
|
34
35
|
private var instance: CacheDataSourceFactory? = null
|
|
35
36
|
|
|
36
|
-
override fun provide(
|
|
37
|
+
override fun provide(
|
|
38
|
+
userAgent: String,
|
|
39
|
+
listener: TransferListener?
|
|
40
|
+
): DataSource.Factory {
|
|
37
41
|
if (instance == null) {
|
|
38
42
|
// Updates the network data source to use the OKHttp implementation
|
|
39
|
-
val upstreamFactory =
|
|
43
|
+
val upstreamFactory =
|
|
44
|
+
OkHttpDataSourceFactory(OkHttpClient(), userAgent, listener)
|
|
40
45
|
|
|
41
46
|
// Adds a cache around the upstreamFactory
|
|
42
|
-
val cache = SimpleCache(
|
|
43
|
-
|
|
47
|
+
val cache = SimpleCache(
|
|
48
|
+
File(cacheDir, "ExoMediaCache"),
|
|
49
|
+
LeastRecentlyUsedCacheEvictor((50 * 1024 * 1024).toLong())
|
|
50
|
+
)
|
|
51
|
+
instance = CacheDataSourceFactory(
|
|
52
|
+
cache,
|
|
53
|
+
upstreamFactory,
|
|
54
|
+
CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR
|
|
55
|
+
)
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
return instance!!
|