Enabling Audio in the App
This is a long standing task. I tried to implement this feature but was unsuccessful. Let’s see how we fare now.
Supporting Material
Community Solution to the sound looping problem
Digital Pro’s No Code Academy Tutorial on Custom Action
Important Background Context
BuildContext
- In Flutter, the build context represents the location of a widget within the widget tree. It allows widgets to interact with other widgets and access data and services provided by higher-level widgets.
Steps Completed
Used the code structure as provided in the Community Solution
Created the custom actions and the app state variables
Configured the app
Things not working (error: Error initializing or playing audio from asset: (4) Failed to load URL)
Sound is still not working
The navigation to “Homepage” when the “Stop” button is pressed on meditation page is not working as the “stopAudio” custom code is not working
Instead of audioRef I have given the “assets/audio/music.mp3” link directly on the custom action but still the error is same
Next Steps
- Perhaps instead of loading the data from asset, I will have to download the data through the network