Skip to content

Feature request: Android Auto play Surah from offline storage. #3744

Description

@mohdosman-dev

Hi - When I connect my phone to a car through Android Auto and choose the Qari and the Surah, the application streams the Surah from the internet. Since I have already downloaded the all Surahs for multiple Qaris, and it works fine on my mobile.

Can you please support Android Auto to read from the offline storage if the Surah for the selected Qari is downloaded and available?

// Check if Surah for Qari is already downloaded.
val offlineSurahUri = surahContentProvider.getOfflineSurahUri(qari, surah)

// If Surah not available, then stream
val surahUri = if (offlineSurahUri != null) offlineSurahUri else baseUrl + makeThreeDigit(sura) + ".$extension"

MediaItem.Builder()
      .setMediaId("sura_${sura}_${qari.id}")
      .setMediaMetadata(
        MediaMetadata.Builder()
          .setIsBrowsable(false)
          .setIsPlayable(true)
          .setTitle(suraName)
          .setDisplayTitle(suraName)
          .setTrackNumber(sura)
          .setTotalTrackCount(114)
          .setArtist(qariName)
          .apply {
            if (showQariSubtitle) setSubtitle(qariName)
            setArtworkUri(artworkUri)
          }
          .build()
      )
      .setMimeType(mimeType)
      .setUri(surahUri)
      .build()

Jazak Allah Khair

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions