1
Play audio - async storage memory overflow - more advice needed
complete
J
Jan-Erik Bruun
I'm still asking for your advice concerning this issue.
My app (ID 435186 "BirdSoundFinland"; runtime 4.5.7) consists of 279 SPECIES pages and each page has 1-40 "play audio"- buttons (totally 2500).
To avoid memory overflow of the device's async storage, I'm in the process of replacing all "stop audio"-functions with "delete audio playback"-functions of each stop-button. This works well if the user pushes on the stop-button but not if the user plays several recordings without stopping.
On each page I have used the same numbering for all "play audio/delete audio playback" ID:s (1-40) and in this way I have been able to perform a general deletion by adding 40 "delete audio playback" functions to the opening of the SEARCH page (see below).
But...if the user prefers to listen to recordings without stopping only through the ALL SPECIES page, a memory overflow problem will soon occur. To prevent this I would need to add the deletion below also to the opening of all the 279 SPECIES pages.
You don't happen to know any simpler solution to this? (a general async storage deletion flow function would be great!)

Log In
T
Timo Kapanen
complete
V
Vili Karilas
Hi Jan-Erik Bruun,
Instead of 30+ outputs, you should set your flow function to only have one or two outputs (one for success, one for failure) and chain the flows one after another. Note that if any of the "delete audio playback" flows fail, they trigger their second output, so you may want to set some logic there in case the functions aren't actually deleting anything. You can also set it to have 0 outputs if you want to trigger them all simultaneously and don't need to validate individual successes.
Your memory issues might be due to the huge size of your app. We'd recommend apps to have less than 50 pages. In any case, you can just split the subflow to two different flows with 20 deletes each. Additionally, consider if there's any case where the users will have more than 30 players on simultaneously.
As for the global canvas, there is no general "page opened" event, so you'll have to make your own custom event. First, add a "receive event" flow function to the global canvas and set it to "fired from 'trigger event'". Then, you can trigger that event from any flow in any page using the "trigger event" flow function and setting it to trigger that event on the global canvas.




J
Jan-Erik Bruun
Vili Karilas: Thanks a lot!!! Since it is not possible to know in advance which audio files the user has opened, I thought it would be best to connect the input to all nodes of the custom flow at the same time.
I also removed all connections from the output nodes.
I managed to setup the trigger event in the Global canvas and on the species page. I was even able to add the 8 missing "delete audio playback"-functions to the custom flow in isolation mode and to complete the save successfully.
I already tested this with some pages and it worked!! So now I only need to add the "Trigger event" to each page opening which will make the remaining work much easier.
I am impressed with all the features Appgyver has to offer!
T
Timo Kapanen
under review
J
Jan-Erik Bruun
Timo Kapanen: I think you can close this issue. The app is working fine. Thanks!
T
Timo Kapanen
Jan-Erik Bruun: great to hear and thanks for confirming!
V
Vili Karilas
Hi Jan-Erik Bruun,
To reduce clutter and having to connect 40 different flows every time, you can make your own custom flows by selecting the ones you want to include and clicking on "Create a new flow function".
You could also move this logic to the global canvas, and bind an app variable change event to trigger the logic whenever you want to delete the audio playback instances (this is considered better practice than having the same logic on every page).
Unfortunately, you'll likely have to make some changes in all of your 279 pages. Hopefully these tips will reduce the amount of work.
J
Jan-Erik Bruun
Vili Karilas: Thank you very much! I will look in to this and see how it works.
J
Jan-Erik Bruun
Vili Karilas: I managed to create a Custom flow by grouping 30 "Delete playback"-flows. More than 30 was not possible to save - probably because of memory limitations. Although I'm working with a powerful pc and cleaning all unnecessary cache-files, I'm struggling at the limit of memory sufficiency all the time. I suppose your server has also predefined memory limits for users.
Anyway, I still think that 30 deletions will be enough (only one bird species exceeds this with 7 more audio files - if necessary, I can remove some less important ones).
It's now a bit unclear to me how I should connect the custom flow. The left knob should probably be connected to Page mounted but what should I do with the Hide spinner-flow?


J
Jan-Erik Bruun
Vili Karilas: You suggested it would be better to move the custom flow to the Global canvas. Perhaps this would be a better option, especially considering the overall app size and the limited memory.
Unfortunately, I am not familiar with how this should be done so please could you instruct me more in detail. I opened the Global canvas/App variables (attachment 3) - should I perhaps use the Open page-navigation flow in some way?

K
Kirill Leventcov
Jan-Erik Bruun:
Hi,
Here is a guide on using logic through the Global Canvas: https://docs.appgyver.com/docs/trigger-event-logic