5 Replies Latest reply on Jul 13, 2016 2:45 PM by kerrishotts

    How to play multiple sound in PHONEGAP DESKTOP?

    akkig5134375 Level 1

      I have created a game in phonegap desktop (not cordova), it has a background music and some special sound (event based), this works fine on PC browser, but when played in mobile (after compiling using the phonegap mobile app) both sound do not play simultaneously... like when the sound effect kick in, the background music stops forever and doesn't plays... does anybody has any idea?

       

      PS: I am currently developing for android, but will also work for ios later

        • 1. Re: How to play multiple sound in PHONEGAP DESKTOP?
          kerrishotts Adobe Community Professional

          Browsers have differing levels of support, and it's entirely possible you're running into that. You might try using the Crosswalk Plugin on Android (but this is not supported by PhoneGap Developer App).

           

          You might also try using a plugin for audio instead on mobile. There are several low latency audio plugins available in the plugin repository (http://cordova.apache.org/plugins).

          1 person found this helpful
          • 2. Re: How to play multiple sound in PHONEGAP DESKTOP?
            akkig5134375 Level 1

            Hi,

             

            So do I need to use CLI for installing the plugin?

             

            Also Is it true that the sound problem will automatically resolve when I convert the file into apk?

            • 3. Re: How to play multiple sound in PHONEGAP DESKTOP?
              kerrishotts Adobe Community Professional

              As with my response to your other question, we're kind of discussing apples vs oranges here.

               

              The PhoneGap Developer app does not support any plugin other than the core plugins and a few third-party plugins. You can't add a plugin to it unless you build your own version of the Developer app.

               

              So, if you want to use a third-party plugin, you have two (and only two) options:

               

              1. PhoneGap CLI (or Cordova CLI)

              2. PhoneGap Build

               

              When using the CLI, you can add a plugin like so:

               

                 phonegap plugin add cordova-plugin-name --save

               

              When using Build (or the CLI) you can add a plugin like so (in your config.xml file):

               

                 <plugin name="cordova-plugin-name" spec="version" />

               

              It may or may not be true that your issue will be resolved when converting into an APK. You can not rely on PhoneGap Developer to prove that your app works or does not work. There are many edge cases that Developer has that you wouldn't otherwise expect (unless you're very familiar with the internal PhoneGap architecture). So don't rely on it to tell you one thing or the other. (It's great for rapid iteration, yes, but not for final testing.)

               

              So, to be sure of anything, either build an app using the CLI or Build.

               

              Note: if you switch to using a plugin, then that would be one way to address your issue regardless. But again, you'd have to build the app using the CLI or PhoneGap Build because it would be a third-party plugin.

              • 4. Re: How to play multiple sound in PHONEGAP DESKTOP?
                akkig5134375 Level 1

                Firstly thanks for the reply

                 

                By your suggestion (in this thread and the other) I am now going CLI, I believe installing a plugin will resolve my polyphony issue so I looked up the link you provided and found cordova-plugin-nativeaudio, will this work with the PG CLI too(it keeps referring to cordova)?

                 

                Isn't there any way to just add it to the PG build? I don't see any documentation for that

                • 5. Re: How to play multiple sound in PHONEGAP DESKTOP?
                  kerrishotts Adobe Community Professional

                  PhoneGap CLI and Cordova CLI are very similar. Most of the Cordova CLI commands work with the PhoneGap CLI (but not necessarily vice versa).

                   

                  For PhoneGap Build, refer to http://docs.phonegap.com/phonegap-build/configuring/plugins/. Keep in mind that not all plugins work with PhoneGap Build, but I see no reason why this one shouldn't.