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

Add support for Linux, maybe publish on Flathub #40

Open
GabMus opened this issue May 16, 2021 · 71 comments
Open

Add support for Linux, maybe publish on Flathub #40

GabMus opened this issue May 16, 2021 · 71 comments
Labels
redesign-beta Issues related to the beta/redsigned version of Finamp

Comments

@GabMus
Copy link

GabMus commented May 16, 2021

Hi, I just tried Finamp and I gotta say it's a pretty great way to listen to Jellyfin music. I was wondering if you wanted to add support for Linux, since this is built with Flutter. This way we could use it on our desktop PCs as well as on the new Linux phones.

Publishing on Flathub would be an added value, you can look at Fluffy chat as an example for another Flutter app that has been published on Flathub.

@GabMus GabMus changed the title Add support for Linux, maybe publish on Flathub [WIP] Add support for Linux, maybe publish on Flathub May 16, 2021
@GabMus GabMus changed the title [WIP] Add support for Linux, maybe publish on Flathub Add support for Linux, maybe publish on Flathub May 16, 2021
@jmshrv
Copy link
Owner

jmshrv commented May 16, 2021

I'd love to create a Linux version, but not all Flutter packages run on all platforms. Many use platform code to use native Android/iOS stuff. Here are all of the packages that are currently incompatible with Linux:

  • device_info (Used to give Jellyfin device info)
  • package_info (Used to give Jellyfin device info)
  • cached_network_image (Image widget that automatically caches image to save bandwidth)
  • just_audio/audio_service/audio_session (The packages that handle audio playback)
  • flutter_downloader (Handles downloads)
  • file_picker (Used to select custom directories)
  • permission_handler (Used to request storage permissions for external directories)

The only packages that are really essential there are the audio packages. I could probably create a desktop interface for device_info and package_info. On desktop, caching images isn't so important, so I could use the normal image widget on desktop. Downloading songs isn't so important on desktop, which would remove the need for file_picker too. permission_handler won't be needed on desktop (it might on macOS, but this issue is about Linux). Of course, this still means that the app won't work on desktop in its current state, unless you want a music player that doesn't play music. The audio packages are actually supported on macOS, so I might work on some desktop stuff for a potential macOS release.

@GabMus
Copy link
Author

GabMus commented May 16, 2021

As I mentioned in the PR, I'm not a dart/Flutter developer, but maybe one could re-implement those interfaces to work on Linux? Or possibly request Linux support for the original libraries?

@jmshrv
Copy link
Owner

jmshrv commented May 16, 2021

Windows/Linux support is being worked on for just_audio. The issue can be viewed at ryanheise/just_audio#103. They're working on using VLC for the backend. For audio_service, a "default audio service" was added since Desktop doesn't rely on platform stuff for background playback (ryanheise/audio_service#609). audio_session may not be required, since that package is meant for configuring the audio player for pausing during calls and stuff.

I might have a look at contributing to the just_audio issue, and I might look into adding MPRIS (and whatever Windows uses) support to audio_service, since the default implementation doesn't really do anything special. No promises though :p

@GabMus
Copy link
Author

GabMus commented May 16, 2021

Any work is highly appreciated! Besides if someone else wants to jump in and contribute, this is already a start :)

@jmshrv
Copy link
Owner

jmshrv commented May 20, 2021

device_info and package_info could be replaced by the "plus" packages that both have desktop support. https://plus.fluttercommunity.dev/

@jmshrv
Copy link
Owner

jmshrv commented Jun 1, 2021

Since everything but flutter_downloader worked on macOS, I tried a macOS version. It technically works, but I've basically just commented out everything related to downloading, which makes the app a bit janky. There are some other issues, such as the settings stuff not loading properly and the progress bar not working. I've pushed the changes to the macos branch if any macOS users want to try messing about with it themselves (not recommended). I'd still like a proper desktop release in the future.

Screenshot 2021-06-01 at 18 16 18

@mbnoimi
Copy link

mbnoimi commented Sep 16, 2021

Did you put a deadline for releasing Finamp desktop client?
I think Flutter for desktop is somehow mature now

@jmshrv
Copy link
Owner

jmshrv commented Sep 16, 2021

It won't be a thing by next release, but maybe the release after. There are three major things that I would have to do:

  1. Add desktop support to just_audio. This shouldn't be too hard since it'll just be a wrapper around dart_vlc.
  2. Create a new download plugin. flutter_downloader is basically entirely native code, so adding desktop support to that would be difficult. Also, flutter_download is a bit buggy with things like download callbacks (this is why download indicators are jank). I'll probably make the plugin in Dart instead of native code for better compatibility.
  3. Make the UI desktop-friendly. The current phone layout won't look right on a big display, so I'd need to mess around with the UI. This would also bring improvements to Finamp on tablets.

@mbnoimi
Copy link

mbnoimi commented Sep 16, 2021

It won't be a thing by next release,

I'm really glad to hear that from you and I wish to see the package in the next release.
Thanks a lot

@jmshrv
Copy link
Owner

jmshrv commented Sep 26, 2021

just_audio just got Windows and Linux support 👀

@jmshrv jmshrv mentioned this issue May 28, 2022
@jmshrv
Copy link
Owner

jmshrv commented May 28, 2022

Posting an update since this issue hasn't had one for a bit:

The Windows/Linux package I mentioned above has been discontinued as it wasn't production ready and the Linux implementation wasn't very good - it created a webview to play the audio in an <audio> tag. There have been some recent developments in ryanheise/just_audio#332 with a proper win32-based package for Windows and an mpv-based package for Linux. The mpv package is a bit early on still but it looks very promising and I personally really like mpv so I have no objection using it.

This all means that I can effectively cross of the GStreamer-based package I was going to make (referenced here). Once I've created the new download package (#213), I will be able to make an initial desktop release. From there, I will create a proper desktop UI, which has the added benefit of improving Finamp on tablets.

@Fale
Copy link

Fale commented May 28, 2022

Very nice to know :-).

Since that part is going to be revamped, it would be nice if - when the Linux Desktop arrives - a Linux Mobile is also provided, which is basically Linux Desktop with the UX of Android/mobile

@jmshrv
Copy link
Owner

jmshrv commented May 28, 2022

The UI will be adaptive so it should show the mobile form factor on mobile displays

@jmshrv
Copy link
Owner

jmshrv commented May 31, 2022

Just leaving this here for myself: Flutter sort of supports Linux ARM targets but it needs to be run from a Linux ARM host. flutter/flutter#60678

@jmshrv
Copy link
Owner

jmshrv commented Jun 14, 2022

ARM support should be doable, setup was basically the same as x86 (this is running on Asahi Linux)

Screenshot from 2022-06-14 12-35-27

@trymeouteh
Copy link

Please release this for Windows and MacOS as well.

For Linux, I would prefer it to be release as the following package types...

AUR
Pacstall
Flatpak

@jmshrv
Copy link
Owner

jmshrv commented Aug 15, 2022

Desktop support will likely come on all platforms at once, it'll just take a while. I should be able to publish on all of those package managers, and I'll also provide a deb, rpm, and a tar.gz of the build for other distros.

@Gecked-Deck
Copy link

Any update on this? Just trying out jellyfin for the first time and would love finamp on desktop.

@jmshrv
Copy link
Owner

jmshrv commented Apr 27, 2023

The main thing that needs to get implemented is #213, as that is needed for desktop.

I could just rip out downloads for desktop, but that would be an annoyingly involved process (in hindsight, I should have made it more easy to enable/disable downloads).

@baarkerlounger
Copy link

Ripping out or disabling downloads would also make it less useful for mobile linux.

@Gecked-Deck
Copy link

Well, for now, I'd love to have Finamp on desktop even without downloads. Downloading being implemeted in the future would be awesome (Especially for Linux Mobile, as mentioned) but I can live without it. Your call, of course, just glad to see there's an effort to get it on desktop at all

@pztrn
Copy link

pztrn commented Apr 27, 2023

Even without downloads, desktop version of Finamp will be very useful. I don't need downloads on my laptop because 99% of time I have working internet connection, as many other people too I presume.

@jmshrv
Copy link
Owner

jmshrv commented Apr 28, 2023

Yeah its very unlikely that you're on a desktop without internet. There will still be a few things other than downloads that needs to be done for desktop (UI, ensuring audio works well), so I won't get this done now. I've started writing in detail what needs to be done for #213, see the linked document there for info.

@NaturalDevCR
Copy link

Hopefully this will see the light, it would be super helpful to have a windows client.

@Chaphasilor
Copy link
Collaborator

Okay, so since we have a new download system in the redesign, adding desktop support is feasible now. I've already got Finamp running on Windows (with the occasional crash), and linux support should also be possible now.
If anyone could take a look into adding linux support (mainly packaging as snap/flatpack/appimage is needed), that would be much appreciated. Use the desktop-beta branch as a starting point.

Here are a few resources that might be useful for that:

Functionality wise, everything should work on linux. If it doesn't, please let me know!

@baarkerlounger
Copy link

@Chaphasilor I've been testing the desktop-beta branch with a view to helping with flatpak packaging. Downloads work fine but playback does not work for me (Debian Testing):

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method success on channel vibrate)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332)
<asynchronous suspension>

@baarkerlounger
Copy link

Another issue (let me know if it would be better to make separate issues for these rather than using this as a Linux catch all) - it seems when you have a play queue it doesn't actually play through them, it stops after each track. The shuffle and repeat buttons are also missing tooltips.

@Chaphasilor
Copy link
Collaborator

Yeah I did notice that too on Windows. It sucks, because it essentially means we cannot use that library. I brought in up in their repo already, but no response yet...

@Chaphasilor
Copy link
Collaborator

Do you think we should go back to the old libs, or is there anything we can do about this? I don't have much time to deal with this, but would like to see this the light of day at some point ^^

@baarkerlounger
Copy link

@Chaphasilor assuming that's a question for me I don't think I can really answer it. I'm not sure if either lib is likely to fix this (or if the problem is even with them). I think my inclination would be to get a release out on Flathub and then iterate on it. Obviously there will be some bugs still but it's use-able already.

@Chaphasilor
Copy link
Collaborator

Do you mean a release with the current libs, where playback stops after a single track? Don't you think that's too much of an issue?

@baarkerlounger
Copy link

I did yes, I guess that's up to you really. I don't think I know enough about Flutter dev to help much here but I did notice both of the just_audio libs look like they're not particularly actively developed/supported. Is using raw media_kit maybe an option?

@Chaphasilor
Copy link
Collaborator

@baarkerlounger as much trouble we might have with just_audio, it actually does its job really well. Even though it's pretty opinioned, it gives us access to a ton of platform-specific functionality, like Android Auto, that we couldn't get with media kit afaik. It's also super-tightly integrated into the app, and we don't have the resources to rip it out any time soon.

However, I managed to fix the bug with playback stopping after each track. I broke stopping in the process, but that's way less important and there's actually no UI to stop at the moment, so it should be fine.
I pushed my changes to the branch, please try if it's also fixed on linux!

@baarkerlounger
Copy link

Nice, yep works for me. Not entirely sure what you mean by broke stopping but I guess that makes sense if you say it's not exposed in the UI.

@Chaphasilor
Copy link
Collaborator

Nice. I also managed to get media buttons and the media notification mostly working on Windows now. Do media buttons work properly on linux too?

@baarkerlounger
Copy link

Media buttons like Play, Pause, Next and Previous all work fine (on desktop, not tested on mobile yet). What notifications should there be?

@baarkerlounger
Copy link

The quick links on the right hand side seem a little janky. Clicking a letter further down the alphabet on a large library seems to scroll through each letter before getting there meaning it takes a couple of seconds to go where you intended rather than jumping straight to the right letter.

@Chaphasilor
Copy link
Collaborator

What notifications should there be?

Well there should be a way to see the currently playing track, including title, artist, artwork and playback progress via mpris. not sure where that is shown, probably depends on your desktop environment. It should be similar to the media notification that is shown on mobile platforms.

And the quick links ("fast scroller") are not working well in general, that's not a desktop issue. With our pagination setup it's not so simple to jump to a page directly, at least not in a way that still supports scrolling up and down to other letters (i.e. not just a plain filter).

I'm currently working on improving the just_audio_media_kit package to fix some playback issues. I think we'll introduce experimental desktop support with the 0.9.5 update. Just need to find someone to test macOS, but since that is natively supported by just_audio and audio_session, there shouldn't be any major hiccups.
@jmshrv already found that auto discovery of local servers isn't working, but that should just be a permission issue.

@baarkerlounger
Copy link

Ah right, yep that is shown in the Gnome notification area 👍 .

That sounds good. In terms of publishing to Flathub that can really happen at any time (now, or when you're happy with 0.9.5), all that's needed is a release bundle and sha to point at and then can be updated anytime by just updating what we point at.

@Nexusnui
Copy link

Is it to early to open another Issue to request a feature for the desktop version?
I thought that "always on top" could be useful for the desktop version.

@Chaphasilor
Copy link
Collaborator

There is a package that supports this: https://pub.dev/packages/window_manager#setalwaysontop
We don't currently use it, but it seems to be quite powerful and useful for many different tasks, so I might actually add that :)
Feel free to open an issue so I don't forget about it ^^

@AverageHelper
Copy link

Just need to find someone to test macOS

@Chaphasilor Cloning now, will post here whether it works :P

@AverageHelper
Copy link

AverageHelper commented Apr 25, 2024

I checked out the desktop-beta branch, ran flutter pub get and flutter run in the repo directory, and the app starts and seems to run just fine on macOS 14.4! My music sounds great :P

EDIT: The UI def feels very "beta", but seems usable so far in these first few minutes.

@AverageHelper
Copy link

Ah, seems toggling Favorite is broken. I get this error in the UI:

'package:finamp/models/finamp_models.dart': Failed assertion: line 790 pos 9: '_verifyEnums()': DownloadItemType.finampCollection BaseItemDtoType.unknown null

tho that could probs go into a separate issue.

@jmshrv jmshrv mentioned this issue May 5, 2024
@Chaphasilor
Copy link
Collaborator

That error should be fixed now :)

@AverageHelper
Copy link

So it is! Thankies ^^

@Chaphasilor Chaphasilor added the redesign-beta Issues related to the beta/redsigned version of Finamp label May 19, 2024
@viasux
Copy link

viasux commented May 24, 2024

Just adding that windows support would be tremendously appreciated. Thanks for the work!

@Chaphasilor
Copy link
Collaborator

@viasux it's already working :)
We just need to get it published to the Microsoft store ^^

@AverageHelper
Copy link

Would a macOS package be possible in releases?

@baarkerlounger
Copy link

baarkerlounger commented Jun 5, 2024

https://flathub.org/apps/com.unicornsonlsd.finamp

Given that Finamp now builds on Linux and is available on Flathub is it worth closing this in favor of more specific packaging or improvement issues?

@Chaphasilor
Copy link
Collaborator

We haven't "officially" released it yet, as there are still some bugs on desktop, especially on Linux. Once we do we'll close this :)
Thanks for your efforts with packaging this for flathub!

@DomiStyle
Copy link

Awesome to see Finamp land on desktop, I have been using the client on Flathub for a few days now and things work pretty well.

Which library currently handles the MPRIS integration? I tried getting the MPRIS data to show on my Stream Deck and noticed that the MPRIS implementation doesn't follow the spec correctly:

https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

org.freedesktop.DBus.Properties.Get("org.mpris.MediaPlayer2.Player", "PlaybackStatus) should return a string wrapped in a variant, instead it returns a string directly.

Seems to work fine with some integrations like KDE's media widget but it's still not to spec and probably should be fixed.

Should I create an issue on Finamp or the library for this?

@Chaphasilor
Copy link
Collaborator

@DomiStyle thanks for looking into it. flathub/flathub#5297 (comment) should tell you what you need to know and what needs fixing :)

@DomiStyle
Copy link

@Chaphasilor Thanks for the info, reported it in the audio-service-mpris repo and should be fixed in the latest version (0.1.5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
redesign-beta Issues related to the beta/redsigned version of Finamp
Projects
None yet
Development

No branches or pull requests