Audio files for playing offline

Hi,

I am a beginner in programming. I’ve been using Appgyver for a few weeks and I’m excited. I’m always discovering new and new uses for features.

However, I can’t figure out how to download or preload audio files to my phone’s memory the first time I run the app, and use the app offline the next time I run the app. As I understand it, Appgyver does not yet support attaching audio files to the apk.

Now I use Preload audio for Playback to preload audio files from my website from wordpress media library after launching the application and on the next page of the application I start playback with the button, but it’s only for online use and after each launch the application be connected to the internet.

Could you help me please?

Thank you very much.

1 Like

Hmmmmmm. I have never done anything like this so I’m not sure how it’s done or if it’d work out, but I’d recommend trying to use the file through open audio player first. You’ll need to download the file(s) onto the device to be able to access them offline.

Hi Mevi,

sorry for my late response. Thank you.

But I have to say “open audio player” is not good component. This function not user friendly like audio player and behaves similar to a video player (show and hide bar). This is not what everyone want from audioplayer. But behaves of this function like slider and buttons is ok. I tried to create something similar, but behaves of slider is not same. Would you take a look at my test application?

I tried Download the files also, but not working for me. I don’t know what I’ve done wrong. Can you please help me with that? Or anyone else?

I still wondered what to use the cache, but it not worked for me.

Please help me.

my test app: https://platform.appgyver.com/builder/applications/188449/pages/1

my other app where I created player by buttons and container which is have width by playing current time, but without seeking by slider: https://platform.appgyver.com/builder/applications/188301/pages/8

Hi!

The audio player isn’t the best, I agree. I’ve actually started to make a composite component that could be used in its stead, but it can’t be published yet without events for composite components. But I’ll share what I can with you so you may get forward.

The slider problem can’t be fixed to be good, unfortunately. For it to be good, the slider would require events for starting sliding and ending sliding. I’ve requested these, but I don’t know if I’ll get them before third party plugins, because there are so many bugs and higher priority things before these.

Instead of a slider, I recommend doing “skip 10s” or “skip 30s” buttons.
Screenshot 2021-02-26 at 9.55.17

I don’t know about the download files for sure. I assume you’d need to download them and then move them to systemVars.fileSystem.directories.document. Google around what the correct place for Android/iOS is, I would assume it to be the kind of path this systemVars produces, but there are other systemVars if it needs to be another place. Remember to always use systemVars to define the path.

I have used a slider for audio and it is a bit sticky but works.

After preloading the audio track, I show a play button and slider.

The play button sets an app variable “current”, which is loop delayed from “get audio playback info”. The slider is set to the app variable current. The slider is numbered equal to the seconds duration of the track in increments of 1.

To get an action when the track finishes, set an app variable “finish” equal to the duration of the track (in seconds from “get audio info”) and set up an “if” node and include this:

IS_SAME(INTEGER(appVars.current), SUBTRACT(INTEGER(appVars.finish), 1))

If your “get audio info” is looping at about 500 ms, and you take one second off the duration to allow for a whole second to register both numbers, the “if” clause will fire when the track is one second from the end.

:slight_smile:

1 Like

It would be helpful to be able to bundle the build file with resources/assets (e.g. audio files mp3) to be able to play sound files from the local device instead of a remote link.

For example in one app I would like to play an optional ‘click’ sound file when the user presses a key.

Currently I need to either play it from a remote url or do a check on application launch if a file is present and then download if necessary and store it in the application folder.

2 Likes