Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media buttons support and auto-pause on headphones disconnect #221

Closed
2 tasks done
talal opened this issue Apr 14, 2023 · 14 comments · Fixed by #211
Closed
2 tasks done

Media buttons support and auto-pause on headphones disconnect #221

talal opened this issue Apr 14, 2023 · 14 comments · Fixed by #211
Labels
enhancement New feature or request priority:high

Comments

@talal
Copy link

talal commented Apr 14, 2023

Describe your suggested feature

As-salamu alaykum,

First of all thank you for this great app, جَزَاكَ ٱللَّٰهُ خَيْرًا

I used to use another app for listening to Quran and two thing that I miss from it, and these are features that I believe will be useful to others too, are media buttons support and auto-pause when playback device disconnects.

Android apps can utilize the media buttons on headphones, and other devices, to pause/resume and skip/rewind the media. Android also has support for pausing media if the external playback device such as headphones are disconnected/unplugged.

This auto-pause feature is especially useful for wireless earbuds so that when you take your earbuds out from your ear and put it in its charging case, the earbuds are disconnected (bluetooth disconnection) from your phone and that leads to the audio getting automatically paused.

This lack of auto-pause can also be inconvenient sometimes, e.g. if you're in a crowded place and listening on your earbuds then putting them back in their case will switch the audio to the loudspeaker and you have to take out your phone and manually pause it.

I believe that media button support and auto-pause will be a great addition to this app as many people use wireless headphones and they would greatly benefit from this.

Here is a link to Android developer docs for your reference: https://developer.android.com/guide/topics/media-apps/mediabuttons

Regards,
Talal

Other details

No response

Acknowledgements

  • I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
  • I have written a short but informative title.
@talal talal added the enhancement New feature or request label Apr 14, 2023
@faisalcodes
Copy link
Member

faisalcodes commented Apr 14, 2023

Walaikum Assalam, Thank you for the detailed explanation. The app has been using old style MediaPlayer for playing audios. I wasted over 5 days implementing "recitation with translation" feature using the same tool. When it was getting out of hand to keep all the advanced features in place, I thought to migrate to Google's ExoPlayer. I started working on implementing the feature along with others which is about to be finished and you can track the progress in this PR.

The features you described are must-haves. Hopefully, they will be there at the end of closing of aforementioned PR, InshaAllah. I am really trying hard to give extra time for this app from my busiest schedule this Ramadan.

You may also test the debug build and share feedback in our discord server.

@talal
Copy link
Author

talal commented Apr 14, 2023

Thanks for the fast response.

It's great to hear that this feature is already on the roadmap :)

I can understand the time constraints and how it can be difficult to maintain and add features to your open source projects.

Once again, thank you for all your hard work towards making this app and keeping it up-to-date with new features!

@faisalcodes
Copy link
Member

These features have been implemented in #211. Kindly test the debug build to see everything goes well.

@talal
Copy link
Author

talal commented Apr 14, 2023

Your link leads to 404. Can you give me a direct link to the APK?

@faisalcodes
Copy link
Member

Its a direct link

@talal
Copy link
Author

talal commented Apr 15, 2023

I still get a 404.

Perhaps the artifacts uploaded by GitHub Actions are not visible to everyone. You can access them because you are the repo owner.

Try opening your link while you're signed out of your GitHub account.

@faisalcodes
Copy link
Member

faisalcodes commented Apr 15, 2023

Not true, I shared the artifact link to other people, they were able to download it. You may not be able to download it while you are signed out.

@talal
Copy link
Author

talal commented Apr 15, 2023

My bad, it was my browser 🙈

The link works and I tested the APK.

The hardware buttons work as expected, play/pause and forward/back.

However, the auto-pause on earphones disconnect doesn't work. The audio keeps playing after disconnection.

@faisalcodes
Copy link
Member

It should work, please try again. Look at the headset icon in notification bar:

Record_2023-04-16-00-58-28.mp4

@talal
Copy link
Author

talal commented Apr 15, 2023

Did you test with a bluetooth device?

I tried with two different wireless earphones and the auto-pause did not work.

Kindly see the attached screen recording, notice the bluetooth icon in the status bar and active device in the settings app. Even after disconnection the audio continues to play.

screen-20230415-222018.mp4

@faisalcodes
Copy link
Member

Okay you are talking about wireless devices. The support is currently only for wired. I will add the support for wireless as well Inshaallah.

@talal
Copy link
Author

talal commented Apr 15, 2023

Thanks!

@faisalcodes
Copy link
Member

I have added support for wireless as well. It should be noted that the player may or may not pause when you change the audio source intentionally using the following button:

Screenshot_2023-04-16-11-42-51-47_b783bf344239542886fee7b48fa4b892

@talal
Copy link
Author

talal commented Apr 16, 2023

I tested the latest APK from your PR and auto-pause now works with wireless earphones 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants