spotube/lib/services
S.B cee65b5f2f
Update audio_player.dart
Key Improvements:

    SpotubeMediaFactory: Handles the logic of creating SpotubeMedia instances, allowing for easier scalability and reducing repetitive code.

    Dependency Injection (DI): CustomPlayer is injected into the AudioPlayerInterface, improving testability and modularity.

    Helper Methods: Functions like getNetworkAddress() and getUriForTrack() simplify and centralize repeated logic, improving maintainability.

    Playback Control Methods: Added play(), pause(), stop(), and seek() methods for better playback control with error handling.

    PlaybackStateManager: Manages the state-related properties (isPlaying, duration, etc.), keeping the AudioPlayerInterface cleaner and more focused on playback control.

Advantages:

    Separation of Concerns: The code is now better structured with clear separation between media management (SpotubeMedia), playback state management (PlaybackStateManager), and playback controls (AudioPlayerInterface).

    Extensibility: The code is more scalable with the factory pattern, making it easy to add new track types or other media sources.

    Testability: With dependency injection, you can easily mock the CustomPlayer and test the logic of AudioPlayerInterface independently.

    Clean Code: Centralized logic and helper methods reduce code duplication, improving readability and maintainability.
2024-10-19 14:48:18 +02:00
..
audio_player Update audio_player.dart 2024-10-19 14:48:18 +02:00
audio_services fix(android): clears queue upon swiping away notification 2024-08-19 21:37:31 +06:00
cli chore: remove old logger 2024-07-06 22:02:31 +06:00
custom_spotify_endpoints refactor: remove uncessary methods 2024-06-11 23:02:23 +06:00
device_info feat: LAN connect a.k.a control remote Spotube playback and local output device selection (#1355) 2024-04-04 22:22:00 +06:00
dio refactor: use replace http with dio and use it as the default 2024-06-01 12:31:20 +06:00
download_manager chore: remove old logger 2024-07-06 22:02:31 +06:00
kv_store chore: add migration script to migrate hive to drift 2024-06-30 15:44:24 +06:00
logger feat(linux): Use XDG_STATE_HOME to storage logs (#1675) 2024-07-14 19:38:28 +06:00
song_link refactor: remove catcher_2 and use custom zoned based error handling 2024-06-09 22:52:34 +06:00
sourced_track fix: changed source doesn't get saved and uses the wrong once again 2024-07-06 21:35:56 +06:00
wikipedia feat(artist): modularize page and add wikipedia section 2023-11-22 20:23:12 +06:00
wm_tools fix(desktop): window is not centered 2024-06-06 13:48:52 +06:00
connectivity_adapter.dart fix: local tracks takes time to load 2024-08-15 22:45:22 +06:00