diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 52293ec..845d084 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -23,7 +23,8 @@ android:icon="@mipmap/ic_launcher" android:banner="@drawable/app_banner" android:usesCleartextTraffic="true" - android:enableOnBackInvokedCallback="true"> + android:enableOnBackInvokedCallback="true" + android:largeHeap="true"> { null } @@ -73,7 +67,9 @@ internal fun ExoPlayer( setConstantBitrateSeekingAlwaysEnabled(true) } - val videoCache = remember { VideoCache.buildCacheDataSourceFactory(context) } + val dataSourceFactory = remember { + DefaultDataSource.Factory(context, DefaultHttpDataSource.Factory()) + } val audioAttributes = AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA) @@ -99,7 +95,7 @@ internal fun ExoPlayer( val exoPlayer = remember { ExoPlayer.Builder(context, renderersFactory) .setTrackSelector(trackSelector) - .setMediaSourceFactory(DefaultMediaSourceFactory(videoCache, extractorsFactory)) + .setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory, extractorsFactory)) .setAudioAttributes(audioAttributes, true) .setHandleAudioBecomingNoisy(true) .setPauseAtEndOfMediaItems(true) @@ -207,30 +203,3 @@ internal fun ExoPlayer( } } } - -@UnstableApi -object VideoCache { - private const val CACHE_SIZE: Long = 150L * 1024L * 1024L // 150 MB - - @Volatile - private var cache: SimpleCache? = null - - fun getCache(context: Context): SimpleCache { - return cache ?: synchronized(this) { - cache ?: SimpleCache( - File(context.cacheDir, "video_cache"), - LeastRecentlyUsedCacheEvictor(CACHE_SIZE) - ).also { cache = it } - } - } - - fun buildCacheDataSourceFactory(context: Context): DataSource.Factory { - val httpDataSourceFactory = DefaultHttpDataSource.Factory() - val upstreamFactory = DefaultDataSource.Factory(context, httpDataSourceFactory) - - return CacheDataSource.Factory() - .setCache(getCache(context)) - .setUpstreamDataSourceFactory(upstreamFactory) - .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR) - } -} \ No newline at end of file diff --git a/lib/screens/shared/detail_scaffold.dart b/lib/screens/shared/detail_scaffold.dart index a807265..27690ed 100644 --- a/lib/screens/shared/detail_scaffold.dart +++ b/lib/screens/shared/detail_scaffold.dart @@ -247,7 +247,7 @@ class _DetailScaffoldState extends ConsumerState { ), ), //Top row buttons - if (AdaptiveLayout.of(context).viewSize < ViewSize.desktop) + if (AdaptiveLayout.inputDeviceOf(context) != InputDevice.dPad) IconTheme( data: IconThemeData(color: Theme.of(context).colorScheme.onSurface), child: Padding(