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);
}
Aggregations