Repository navigation
Fall back to mp3 on devices without an Opus decoder (#4018) - #4019
Open
m86hussein wants to merge 1 commit into
Open
m86hussein wants to merge 1 commit into
m86hussein wants to merge 1 commit into
Conversation
New downloads and streaming use Opus after 3.6.1. Devices without an Opus decoder (e.g. some e-ink tablets) play Opus silently: playback advances but no audio is produced, while mp3-only qaris keep working. Gate the Opus format on actual device decoder support (queried via MediaCodecList) in QuranAudioExtensionDecider and fall back to mp3 otherwise, for both downloads and streaming. Addresses quran#4018
Contributor
|
JazakumAllah khairan patch looks good but one question is as to whether or not the device reports opus support or not (silent playback suggests to me (?) that it might report it as present when it isn't?) |
ahmedre
reviewed
Nov 9, 2026
Contributor
There was a problem hiding this comment.
let's also add a
appCoroutineScope.launch { audioDecoderCapabilities.isOpusSupported() }in the application subclass - and add a provides method for auto?
| * [AudioDecoderCapabilities] implementation backed by the platform [MediaCodecList]. The result | ||
| * is computed once and cached, since the set of available decoders does not change at runtime. | ||
| */ | ||
| @ContributesBinding(AppScope::class) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #4018 — on devices without an Opus decoder, audio downloaded/streamed after 3.6.1 plays silently (highlighting advances, no sound), while mp3-only qaris (e.g. Basfar) keep working.
As discussed in the issue, after 3.6.1 new downloads/streaming default to Opus (via
QuranAudioExtensionDecider). Some devices — notably certain e-ink tablets (Onyx BOOX, Android 15) — ship firmware without a system Opus decoder, so ExoPlayer has nothing to decode the stream with and fails silently.Why not bundle the Opus decoder?
The obvious "just ship a software Opus decoder" route isn't viable here: the media3 decoder extensions (
androidx.media3:media3-decoder-opus) are not published to Google Maven and require a from-source NDK build. So instead this PR makes format selection aware of what the device can actually play.Change
AudioDecoderCapabilitiesinterface +MediaCodecAudioDecoderCapabilitiesimplementation that queries the platformMediaCodecListonce (cached) for anaudio/opusdecoder.QuranAudioExtensionDecidernow only prefers Opus when the qari has an opus URL and the device has an Opus decoder; otherwise it uses mp3.allowedAudioExtensionslikewise returns onlymp3on devices without an Opus decoder, so stale/undecodable opus files aren't treated as valid.This is device-agnostic (fixes every device lacking an Opus decoder, not just BOOX) and routes through the single existing format chooser, so both the download and streaming paths are covered.
Tests
QuranAudioExtensionDeciderTestcovering the no-opus-decoder device case for bothQariandQariItem; existing opus/mp3 behavior is preserved via an injected fake capability.Verification note
I don't have a BOOX / e-ink device, so I couldn't verify end-to-end on affected hardware. The decider logic is covered by unit tests; on-device confirmation from the reporter would be appreciated. Happy to adjust the approach (e.g. combine with an ExoPlayer decoder-init exception fallback) based on your preference.