recloudstream / cloudstream

Android app for streaming and downloading media.
GNU General Public License v3.0
6.8k stars 546 forks source link

Enable Android's Media Controls (Next & Previous) Tracks to go to navigate episodes. #1386

Open elvistony opened 1 month ago

elvistony commented 1 month ago

Describe your suggested feature

Like music players, would it be too much effort in adding the ability to get the previous track, next track ability to go back or to the next episode (like in the notification bar).

I'm come right into the point, when I use gestures on my headphones/ the next button on my headphone, it would be awesome if it goes to the next episode.

Media Controls Documentation

The same can also improve experience on the tv (I've got a bunch of extra mappable buttons that I can use to trigger a next track or previous track using Button Mapper. If the app could support this track switching it would complete the picture!

Thanks for reading this all the way here. Warm Regards Lvz

Other details

Something like this?

Source: Google Music Player

Acknowledgements

fire-light42 commented 1 month ago

Cs3 already uses mediasession and notably you should already be able to pause and play videos with the pause button on your headphones.

https://github.com/recloudstream/cloudstream/blob/f30319ff7cb3cdaa34207171c5f691f198e3430c/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt#L351

Additionally cs3 already has a lot of keybindings

https://github.com/recloudstream/cloudstream/blob/f30319ff7cb3cdaa34207171c5f691f198e3430c/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt#L484

elvistony commented 1 month ago

Awesome! I hadn't seen these keycodes mentioned elsewhere!...

I did see that the KEYCODES's for NextEpisode and PreviousEpisode was limited to KeyEvent.KEYCODE_MEDIA_NEXT, KeyEvent.KEYCODE_BUTTON_R1, KeyEvent.KEYCODE_N and these wouldn't be present on a regular tv remote.

Could we Add Channel_UP and Channel_DOWN or KEYCODE_NUMPAD_1 and KEYCODE_NUMPAD_2 for accommodating tv remotes.

https://github.com/recloudstream/cloudstream/blob/f30319ff7cb3cdaa34207171c5f691f198e3430c/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt#L496-L498

Source to Keycodes info for Channel_UP and Channel_DOWN : Stackoverflow

 * On TV remotes, increments the television channel. */
KEYCODE_CHANNEL_UP = 166;
/** Channel down key.
 * On TV remotes, decrements the television channel. */
KEYCODE_CHANNEL_DOWN = 167;

Thanks for shedding light to this section of code! I bet I'll be using some of these key events from now on!

Cheers!

elvistony commented 1 month ago

If anyone is tracking this Issue, @fire-light42 has merged the update! Great News!

Not sure when a release would be deployed though.

fire-light42 commented 1 month ago

It is already in prerelease, so if you cant want for stable then use the prerelease