How to make the app work when the phone is locked?

0 favourites
  • 4 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • In my application, the Audio Plugin downloads .mp3 file from the internet and plays it.

    But when the phone is locked, all playback stops. I assume that the work of the program itself stops.

    Enabling "Play in background" in the Audio plugin didn't help.

    How can I keep the app downloading and playing audio files when the phone is locked?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • From what I understand, Audio Play in Background only works for an audio that started playing when the game was running. Then it'll stop and not play any other audio as soon as it is finished.

    In my opinion, this is a feature that should be enabled for dev and user consent, instead of blocked, since run in background tend to be important. I know it has to be used with caution, but this caution could maybe be controlled from the framework side.

    Anyway, that said, I use a plugin called "Run in Background". It's kinda tricky, but it sure works on Android Platforms (Browser) and Desktops, but doesn't on iOS.

    https://www.construct.net/en/make-games/addons/462/run-background

    It even have an exemple file, it's worth checking out.

  • From what I understand, Audio Play in Background only works for an audio that started playing when the game was running. Then it'll stop and not play any other audio as soon as it is finished.

    In my opinion, this is a feature that should be enabled for dev and user consent, instead of blocked, since run in background tend to be important. I know it has to be used with caution, but this caution could maybe be controlled from the framework side.

    Anyway, that said, I use a plugin called "Run in Background". It's kinda tricky, but it sure works on Android Platforms (Browser) and Desktops, but doesn't on iOS.

    https://www.construct.net/en/make-games/addons/462/run-background

    It even have an exemple file, it's worth checking out.

    Maybe I didn't describe the problem clearly. I wanted to implement the standard work of a music player in my application, download .mp3 files from a list and play these files. When the application is running, everything works fine, but as soon as you lock the phone, the application stops working.

    I wanted to find out how to implement it exactly in the Construct without using plugins from other developers, since then it’s hard to maintain the application.

    Thanks for the link to the plugin, but its the last update in 2020.

  • Without the plugin's help, it will probably be impossible to achieve it without going into written coding of the game's files. The only downfall of this plugin (at least when exporting to HTML5) is that it does not work with Advanced Minify of the export settings (only with Simple).

    Maybe look into some pure Javascript coding to write into C3 without plugins, but from what I tried, it appeared to be hard to impossible. :(

    I've seen that this plugin works in a similar way to the native multiplayer functions of C3, maybe there's something to look into it. But if you run out of time, I can tell you that with the plugin you can achieve your goal (at least on Destkop and Android Devices).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)