Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tuuhin
Copy link
Owner

@tuuhin tuuhin commented Dec 9, 2025

Fixes for the raised issue #22 alongside performance improvements focused on audio playback, editing, and visualization efficiency

Key Changes

  • Player Flow Correction: Inconsistencies where player state flows were not correctly based on the current player instance. The flows now accurately reflect the initial playing state.
  • Simplified Audio Editor Route: Rather than putting the whole AudioFileModel with factory in view model, we read the audioId and later compute the AudioFileModel in the AudioEditorViewmodel
  • Enhanced Thread Management: Explicit stop thread calls are implemented to clean up HandlerThread instances on stop or destruction. This resolves potential resource leaks and ensures the visualizer thread stops immediately upon extraction completion.
  • Media Controller Refinements: The Media Controller setup process is now more reliable, moving the Media Session configuration to the Callbacks and using MediaControllerState to prevent race conditions and ANR issues.
  • Others: Updated navigation animations with new easing and corrected version names/documentation files.

SharedElementModifiers.kt  parameters naming was changed in library
Rather than setting up the media session on MediaPlayerService.kt configuring it on AudioPlayerMediaCallBacks.kt
In AudioPlayerViewModel.kt we cancel the ongoing controller setup if ControllerEvents.OnRemoveController is called so controller is not being created if ongoing
MediaControllerProvider.kt filterNotNull is causing the Ui to enter ANR
Using MediaControllerState.kt to control the setup and cleanup
PendingIntentUtils.kt is now based on context rather than service
In PlayerFileProviderImpl we first read the file from media store and then after load the metadata content later on done this helps the screen to load relatively  faster
In PlayerMetadataViewmodel.kt shortcut is changed on every AudioFileModel update we just need the id here so another flow collector with distinct by id is used which sets the shortcut.
EvaluateWithReadingTime.kt is a small logging function to check how much time being used to extract metadata
In PlayerFileProvider.kt we need to check if the file exists too before returning the content uri
Again not capturing the audio file error here and in AudioPlayerViewModel.kt
Updated ContentStateAnimatedContainer.kt the transformation is simplified and also loading screen was not showing included that
ic_music_file.xml the content is updated with new illustration
Also updated the strings.xml for the new button text
Player flows were configured incorrectly the initial state was not based on the current player instance but the default one in PlayerIsPlayingFlow.kt initial is made based on the playerState and isPlaying flag
Similarly in PlayerTrackDataFlow.kt if the track is already being played there was no listener for it so track data was not being emitted
So initially we check if its playing state then we start the periodic updates
First ThreadControllerModule.kt is not activity retained scoped not a singleton
ThreadController.kt included stop thread call, this calls checks and stop the handler thread produced via bind to lifecycle
In ThreadController.kt we stop the thread if lifecycle is on destroy or stop thread is called
HandlerExt.kt provides extension over the handler thread
MediaCodecPCMDataDecoder.kt initiate extraction is done on io extractor, and the handler thread is check if alive then only decoder is created,if any of the handler.post call fails then
normal call is made ensuring what is initialed should always clean
ControllerLifeCycleObserver.kt is now bounded to start-stop lifecycle
In AudioVisualizerImpl.kt stoping the thread by call when the extraction is done rather than waiting for on destroy lifecycle event
Rather than passing the whole AudioFileModel in the viewmodel simplifying creating in EditorViewmodelFactory.kt which as all only takes a fileId later we read the file from media store
PlayerSubGraph.AudioEditorRoute also needs audioId thus easier to call toRoute in AudioEditorRoute.kt
New SharedElementModifiers.kt are added
As like player viewmodel we set up the player and the current file then work on that similarly we do the same in here too
AudioEditorRoute.kt and AudioEditorScreen.kt
Simplified no more extra container and a stateful version we take the whole thing as one
Moved the audioId out of AudioPlayerScreen.kt and used the shared bounds wrapper in AudioPlayerRoute.kt
Easing in navigation animations are changed
README.md and module_graph.md are corrected
Bumped version code and version no to next version
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

Instrumented Test Results (API 36)

24 tests  ±0   24 ✅ ±0   12s ⏱️ ±0s
25 suites ±0    0 💤 ±0 
25 files   ±0    0 ❌ ±0 

Results for commit 24d88a0. ± Comparison against base commit c0388f5.

@tuuhin tuuhin merged commit eae3a32 into main Dec 9, 2025
3 checks passed
@tuuhin tuuhin deleted the bug-fixes branch December 9, 2025 13:47
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.

2 participants