androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.71k stars 409 forks source link

Use DatabaseProvider with Room #783

Closed dabluck closed 1 year ago

dabluck commented 1 year ago

If I want to use SimpleCache for a CacheDataSource, it requires a database provider. DatabaseProvider only takes an Android SQLiteDatabase.

If we're using Room, we only have a RoomDatabase which is built on the androidx sql libraries, and we only have a SupportSqliteHelper which gives only a SupportSQLiteDatabase.

As far as can tell, the only workaround is to write your own Cache. Duplicating all the logic in SimpleCache to simply switch out a support library is a lot of work.

Is there any alternative I'm missing?

tonihei commented 1 year ago

I think this is a duplicate of https://github.com/google/ExoPlayer/issues/5933. If you are motivated, feel free to send a PR to make this update. We haven't got around to do this ourselves yet.

dabluck commented 1 year ago

@tonihei if I sent a PR are you okay with the hard dependency on the sqlite support lib?

tonihei commented 1 year ago

Yes, you are right, this is a potential concern with this approach that wasn't immediately clear when I suggested to write a PR. I'll have a look at #784 and leave further comments there.