Search in sources :

Example 1 with StreamingAudioRequest

use of com.quran.labs.androidquran.service.util.StreamingAudioRequest in project quran_android by quran.

the class PagerActivity method playStreaming.

private void playStreaming(SuraAyah ayah, SuraAyah end, int page, QariItem item, int verseRepeat, int rangeRepeat, boolean enforceRange) {
    String qariUrl = audioUtils.getQariUrl(item);
    String dbFile = audioUtils.getQariDatabasePathIfGapless(this, item);
    if (!TextUtils.isEmpty(dbFile)) {
        // gapless audio is "download only"
        lastAudioDownloadRequest = getAudioDownloadRequest(ayah, end, page, item, verseRepeat, rangeRepeat, enforceRange);
        playAudioRequest(lastAudioDownloadRequest);
        return;
    }
    final SuraAyah ending;
    if (end != null) {
        ending = end;
    } else {
        // this won't be enforced unless the user sets a range
        // repeat, but we set it to a sane default anyway.
        ending = audioUtils.getLastAyahToPlay(ayah, page, quranSettings.getPreferredDownloadAmount(), isDualPages);
    }
    AudioRequest request = new StreamingAudioRequest(qariUrl, ayah, quranInfo.getNumAyahs(ayah.sura));
    request.setPlayBounds(ayah, ending);
    request.setEnforceBounds(enforceRange);
    request.setRangeRepeatCount(rangeRepeat);
    request.setVerseRepeatCount(verseRepeat);
    play(request);
    audioStatusBar.switchMode(AudioStatusBar.PLAYING_MODE);
    audioStatusBar.setRepeatCount(verseRepeat);
}
Also used : StreamingAudioRequest(com.quran.labs.androidquran.service.util.StreamingAudioRequest) DownloadAudioRequest(com.quran.labs.androidquran.service.util.DownloadAudioRequest) AudioRequest(com.quran.labs.androidquran.service.util.AudioRequest) SuraAyah(com.quran.labs.androidquran.data.SuraAyah) StreamingAudioRequest(com.quran.labs.androidquran.service.util.StreamingAudioRequest)

Aggregations

SuraAyah (com.quran.labs.androidquran.data.SuraAyah)1 AudioRequest (com.quran.labs.androidquran.service.util.AudioRequest)1 DownloadAudioRequest (com.quran.labs.androidquran.service.util.DownloadAudioRequest)1 StreamingAudioRequest (com.quran.labs.androidquran.service.util.StreamingAudioRequest)1