mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-10 05:48:38 +02:00
Add:Check for OnePlus on playing ab with local cover #35
This commit is contained in:
@@ -674,19 +674,29 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||||||
|
|
||||||
// Issue with onenote plus crashing when using local cover art. https://github.com/advplyr/audiobookshelf-app/issues/35
|
// Issue with onenote plus crashing when using local cover art. https://github.com/advplyr/audiobookshelf-app/issues/35
|
||||||
if (currentAudiobookStreamData?.coverUri != null && currentAudiobookStreamData?.isLocal == true) {
|
if (currentAudiobookStreamData?.coverUri != null && currentAudiobookStreamData?.isLocal == true) {
|
||||||
try {
|
var deviceName = Build.DEVICE
|
||||||
Log.d(tag, "CHECKING COVER ${currentAudiobookStreamData?.coverUri}")
|
var deviceMan = Build.MANUFACTURER
|
||||||
var file = DocumentFile.fromTreeUri(ctx, currentAudiobookStreamData!!.coverUri)
|
var deviceModel = Build.MODEL
|
||||||
Log.d(tag, "GOT FILE ${file?.name} | ${file?.type} | Can Read: ${file?.canRead()} |isExternalStorageDocument: ${file?.isExternalStorageDocument}")
|
Log.d(tag, "Checking device $deviceName | Model $deviceModel | Manufacturer $deviceMan")
|
||||||
if (file?.canRead() !== true) {
|
if (deviceMan.toLowerCase().contains("oneplus") || deviceName.toLowerCase().contains("oneplus")) {
|
||||||
Log.d(tag, "Invalid cover: no read access")
|
Log.d(tag, "Detected OnePlus device - removing local cover")
|
||||||
currentAudiobookStreamData?.clearCover()
|
|
||||||
}
|
|
||||||
} catch(e:Exception) {
|
|
||||||
Log.d(tag, "Invalid cover: Failed to read local cover file $e")
|
|
||||||
currentAudiobookStreamData?.clearCover()
|
currentAudiobookStreamData?.clearCover()
|
||||||
e.printStackTrace()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OnePlus devices were showing valid permissions for image
|
||||||
|
// try {
|
||||||
|
// Log.d(tag, "CHECKING COVER ${currentAudiobookStreamData?.coverUri}")
|
||||||
|
// var file = DocumentFile.fromTreeUri(ctx, currentAudiobookStreamData!!.coverUri)
|
||||||
|
// Log.d(tag, "GOT FILE ${file?.name} | ${file?.type} | Can Read: ${file?.canRead()} |isExternalStorageDocument: ${file?.isExternalStorageDocument}")
|
||||||
|
// if (file?.canRead() !== true) {
|
||||||
|
// Log.d(tag, "Invalid cover: no read access")
|
||||||
|
// currentAudiobookStreamData?.clearCover()
|
||||||
|
// }
|
||||||
|
// } catch(e:Exception) {
|
||||||
|
// Log.d(tag, "Invalid cover: Failed to read local cover file $e")
|
||||||
|
// currentAudiobookStreamData?.clearCover()
|
||||||
|
// e.printStackTrace()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
var metadata = currentAudiobookStreamData!!.getMediaMetadataCompat()
|
var metadata = currentAudiobookStreamData!!.getMediaMetadataCompat()
|
||||||
|
|||||||
Reference in New Issue
Block a user