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 audio playback on Linux #1511

Merged
merged 2 commits into from
Apr 25, 2023
Merged

Add audio playback on Linux #1511

merged 2 commits into from
Apr 25, 2023

Conversation

matthiasn
Copy link
Owner

Resolves #1510 by replacing [just_audio](https://pub.dev/packages/just_audio) with media_kit since the former did not support Linux.

@matthiasn matthiasn force-pushed the audio_playback_linux branch 4 times, most recently from 64566f4 to 3dda3c9 Compare April 25, 2023 01:56
@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2023

Codecov Report

Merging #1511 (951c953) into main (05b8088) will decrease coverage by 0.07%.
The diff coverage is 35.29%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #1511      +/-   ##
==========================================
- Coverage   70.90%   70.84%   -0.07%     
==========================================
  Files         256      256              
  Lines       10817    10811       -6     
==========================================
- Hits         7670     7659      -11     
- Misses       3147     3152       +5     
Impacted Files Coverage Δ
lib/pages/settings/sync/sync_assistant_page.dart 1.09% <0.00%> (+0.01%) ⬆️
lib/sync/inbox/process_message.dart 50.00% <0.00%> (-3.66%) ⬇️
lib/widgets/sync/imap_config_status.dart 100.00% <ø> (ø)
lib/blocs/audio/player_cubit.dart 12.06% <12.50%> (-6.58%) ⬇️
lib/themes/theme.dart 70.27% <100.00%> (-0.79%) ⬇️
lib/widgets/sync/imap_config_form.dart 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


void ensureMpvInitialized() {
if (isMacOS) {
NativeLibrary.ensureInitialized(libmpv: '/opt/homebrew/bin/mpv');
Copy link
Collaborator

@alexmercerind alexmercerind Apr 25, 2023

Choose a reason for hiding this comment

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

media_kit bundles libmpv within media_kit_libs_macos_audio, by the way.
I'm not sure how if using external version will be a good idea.


Also... silly me. I forgot passing this argument in MediaKit.ensureInitialized.
What a goofy bug. I'm adding tests. It'll be addressed in next update.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah nice, that means I can remove that hack after updating the lib? Awesome, thanks for fixing it, felt like an odd hack having to do that to make the tests pass. Should have filed an issue right away :]

@@ -1,4 +1,4 @@
platform :osx, '10.15'
platform :osx, '11.0'
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're reducing the minimum supported macOS version (if it matters) to improve backwards compatibility:
media-kit/libmpv-darwin-build#7

@matthiasn matthiasn merged commit 6e7e33f into main Apr 25, 2023
@matthiasn matthiasn deleted the audio_playback_linux branch April 25, 2023 21:59
@alexmercerind
Copy link
Collaborator

alexmercerind commented Apr 26, 2023

Also, may I suggest --split-per-abi in Android build?

It can make huge difference. In current APK:

  • There doesn't seem to be any compression in APK (compression ratio is 0).
  • x86 native libraries are also bundled.
    • Flutter only supports arm64-v8a, armeabi-v7a & x86_64.
    • Dart can't compile to x86 in AOT (release) mode. So, there's no point of including those x86 libraries in release build.
    • media_kit & sqlite3 offer x86 binaries to support debug-mode for emulators running on AMD devices.

For each architecture, say arm64-v8a, media_kit adds about 5 MB to provide a really strong (in terms of codec support & performance).

Current 130 MB is undoubtedly very large. Out of which, most can be reduced with compression (possibly automatically done with --split-per-abi), 14 MB is redundant x86 binaries. As far as my approximation goes, --split-per-abi should give acceptable 18-25 MB APK for each architecture.

@matthiasn
Copy link
Owner Author

@alexmercerind thanks a lot, yeah I noticed that the APK had grown quite substantially recently after adding media_kit, from 83.8 MB last week, but I didn't have time to investigate yet. Will try out your suggestion now.

@matthiasn matthiasn mentioned this pull request Apr 26, 2023
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.

Audio playback not working on Linux
3 participants