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

Last.fm scrobbling is broken on Linux #908

Open
vimproved opened this issue Sep 29, 2024 · 3 comments
Open

Last.fm scrobbling is broken on Linux #908

vimproved opened this issue Sep 29, 2024 · 3 comments
Labels
desktop Desktop-specific issues playback reporting Issues related to playback reporting playback Issues related to playback redesign-beta Issues related to the beta/redsigned version of Finamp upstream issue Issue requires changes to an upstream project (Flutter framework, used package/plugin)

Comments

@vimproved
Copy link

vimproved commented Sep 29, 2024

On Linux (flatpak), it seems like Finamp never properly reports a track as completed to the server. While playing a track, it correctly shows up in last.fm as "playing", however it never gets scrobbled properly. Just from a surface-level inspection, I think this stems from the same base issue as #907, which is that the playbackState never gets properly updated to AudioProcessingState.completed, which is evidenced by the fact that in the logs, PlaybackHistoryService doesn't log a "Stopping playback progress" message when a track is completed, and it instead logs an "Updating playback state" message and just repeats from the beginning of the queue immediately.

@vimproved
Copy link
Author

Going a bit further, I think this may actually be an issue in just_audio_media_kit. This is just a theory, so tell me if I'm wildly off base though since I have no experience with flutter.

Whenever something is queued up in Finamp, it throws this error in the console:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (length): Invalid value: Valid value range is empty: 0
#0      _Array.[] (dart:core-patch/array.dart)
#1      MediaKitPlayer._currentMedia (package:just_audio_media_kit/mediakit_player.dart:39)
#2      new MediaKitPlayer.<anonymous closure> (package:just_audio_media_kit/mediakit_player.dart:60)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365)
#5      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:297)
#6      _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123)
#7      _DistinctStream._handleData (dart:async/stream_pipe.dart:439)
#8      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153)
#9      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594)
#10     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365)
#11     _DelayedData.perform (dart:async/stream_impl.dart:541)
#12     _PendingEvents.handleNext (dart:async/stream_impl.dart:646)
#13     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617)
#14     _microtaskLoop (dart:async/schedule_microtask.dart:40)
#15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

The relevant snippet from just_audio_media_kit is

Media get _currentMedia =>
      _player.state.playlist.medias[_player.state.playlist.index];

This is making me think that the playlist is not getting initialized properly, and that's causing just_audio_media_kit to not properly send out the completed event. I'm wondering if Pato05/just_audio_media_kit#17 would maybe fix this (unfortunately I don't have the means to test this myself).

@Chaphasilor
Copy link
Collaborator

Hey, thanks for investigating this yourself! Yes, it seems like this is an upstream issue. Playback for Finamp on desktop doesn't yet behave exactly as on mobile, which throws off some of the playback reporting.
Btw, do you have the Playback Reporting plugin installed on your server? If yes, does it show the correct durations, or not?

@Chaphasilor Chaphasilor added upstream issue Issue requires changes to an upstream project (Flutter framework, used package/plugin) desktop Desktop-specific issues playback Issues related to playback redesign-beta Issues related to the beta/redsigned version of Finamp playback reporting Issues related to playback reporting labels Oct 3, 2024
@Chaphasilor
Copy link
Collaborator

Upstream PR got merged now, so this should trickle down into Finamp within the next two versions or so :)
Please remind me if I happen to forget upgrading the dependencies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Desktop-specific issues playback reporting Issues related to playback reporting playback Issues related to playback redesign-beta Issues related to the beta/redsigned version of Finamp upstream issue Issue requires changes to an upstream project (Flutter framework, used package/plugin)
Projects
None yet
Development

No branches or pull requests

2 participants