quran / quran_android

a quran reading application for android
http://android.quran.com
GNU General Public License v3.0
2.01k stars 889 forks source link

gapless Audio #283

Closed Eng-Fouad closed 4 years ago

Eng-Fouad commented 11 years ago

Salam Alaikum,

The app is just impressive, may Allah bless you. I was just wondering why don't make all "التلاوات" to be gapless? Here is one way I am thinking of you can use to implement such feature:

I am a Java developer and I can help in this part. Here is my twitter account: @EngineerFouad

Best Regards~

ahmedre commented 11 years ago

wa3laikum alsalam, jazakAllah khairan. the download isn't the issue since "downloading" is the default mode (which means that all the files will be downloaded before we start streaming).

i think someone gave us a similar solution to what you suggested, but we didn't use it because in general, the MediaPlayer objects are fairly heavy. the solution i wanted to implement is to use setNextMediaPlayer methods in MediaPlayer, which was introduced as of api level 16.

so i think we should go with this approach insha'Allah since it's simpler and lighter weight. walsalam 3alaikum.

Eng-Fouad commented 11 years ago

Thanks for quick reply. First of all, I am not familiar with setNextMediaPlayer() in API 16 but I think it needs a data source which is the file of the next ayah, which is needed to be exist at the time of calling setNextMediaPlayer(). Second, can you use setNextMediaPlayer() while the app is running at level API 8?

Finally, as you said that the files are downloaded before streaming them, thus no concerns needed regarding the RAM since we deal with files only. In other words, the queue would contain instances of a wrapper class that holds information about the Ayah and the file path. You would only use one instance of MediaPlayer.

Thanks.

ahmedre commented 11 years ago
  1. yes, that shouldn't be a problem.
  2. yes, but it will only work on api level 16+.

i don't think a lot of processing is happening - the reason for the space (i think) is due to MediaPlayer itself and how it swaps out the files (since at that point, the file is already downloaded, so in theory, it should be very quick to start playing it, especially when not on an external-sdcard).

ozbek commented 7 years ago

Possible duplicate of #231

vipafattal commented 5 years ago

Salam Alaikum, I'm impressed by the work that has been done on the app. I just want to suggest to use Exoplayer in order to get gapless audio it's really an advanced audio framework, I built Quran app inspired by Quran Android that uses Exoplayer to play multiple Ayat. The gape's almost not noticeable in recitation. I'll put a link to test the app, just click on Aya number in the app and press play button. https://drive.google.com/file/d/1auO-B9aMJlSWd846CylRg9G-ciRnO1u0/view?usp=sharing

I can give the link to the app repository on GitHub if liked the result.

Thanks for your efforts.

ozbek commented 5 years ago

Wa alaikum assalam @vipafattal.

Sounds like an awesome upgrade. Tested with "Maher Al Muaiqly", gaps are handled more graciously.

Please send PR.

ahmedre commented 5 years ago

wa3laikum alsalam, masha'Allah this is awesome - if you have time to work on a PR, please feel free, otherwise in sha' Allah will try to do this. walsalam 3alaikum.

vipafattal commented 5 years ago

Gald you liked it! I'm really sorry, but currently, I don't have time to manage to create PR. Anyway, I have decided to make Musahf open source here is a link to the repository: Musahf See how I managed to create a media source for every reciter link for streaming play on offline from file play MediaSourceBuilder.kt then I'm passing the created media source in ReciterPlayer.kt (see 'onDownloadingCompleted' function) to ReadQuranActivity.kt.

Helpful links to Exoplayer: Google codelab Google Exolpayer Pub on medium

ahmedre commented 4 years ago

today, all except 5 qaris are gapless. likely makes more sense to gapless those qaris instead at this point and remove gapped support completely.

i also have a branch that switches to exoplayer (as of the end of December 2019), though I didn’t plug any special transitioning logic for gapped audio into it. can consider pushing that as the primary player in the future in sha’ Allah.