Skip to content

feat: Better Players - #1053

Draft
nnra6864 wants to merge 2 commits into
commetchat:mainfrom
nnra6864:better-players
Draft

nnra6864 wants to merge 2 commits into
commetchat:mainfrom
nnra6864:better-players

Conversation

@nnra6864

Copy link
Copy Markdown

This PR aims to implement basic controls to media players, such as volume changing.
I'll also look into implementing .mkv and .jxl support.
I could also try implementing #1052 if it's not merged by the time I get to it.

For now, I implemented the persistent audio player volume control, and will start working on the video player.
image

If you'd like, I can split the format support into a separate PR, whatever works the best for you.

closes #1051

fix: Saving the preMuteVolume instead of regular volume to prefs

style: Adjusted naming

style: Reordered func for consistency
@nnra6864

Copy link
Copy Markdown
Author

Hey, I skimmed through the video player implementation yesterday and realized that a lot of the code would be duplicated if I just copied the volume implementation.
Would you like me to extract volume control/widgets into a separate class, and see if some other controls could be extracted into that class too?

I am also open to suggestions as to how this could be made better.
The PR so far is only a rough implementation, and I already have a few minor improvements in my mind.

double preMuteVolume = 50;

Future<void> _savePreferences() async {
final prefs = await SharedPreferences.getInstance();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont use SharedPreferences directly, instead go through the preferences global variable

https://github.com/commetchat/commet/blob/main/commet/lib/config/preferences.dart

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great recommendation.
This makes my work significantly easier.
Done in fdb05a2.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the interface would be better if the slider was something shown in a tooltip popup when clicking or hovering the volume icon, instead of having a slider in-line

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea.

I don't have any prior experience with flutter, so I'd appreciate a suggestion for the class I should use to achieve this.
I ran into Overlay, but that seems a bit more complicated to use, so should I stick with that or switch to some other component I am unaware of?

Also, whilst I am at this, should I make the slider vertical?
This should be fairly easy to achieve with a RotatedBox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Better media player

2 participants