9 Replies Latest reply on Jul 20, 2016 2:55 PM by kerrishotts

    Phonegap Build App not working when hydra is disabled

    venkyr81192151

      I have a fully functional phonegap build which works 100% correctly when hydra is enabled but when I create a build without hydration, one key functionality is not working.

       

      - This bug may not be a whitelist issues, as all the files are available locally, no JS file is called from outside the app.

       

      - No plug-in are used

       

      Please note: Code works perfectly when:

      1) When Phonegap build is created with hydra enabled

      2) When viewed in mobile browser offline.

      3) In Chrome, Firefox, Safari desktop browsers.

       

      Regards,

      Venkat

        • 1. Re: Phonegap Build App not working when hydra is disabled
          VectorP Level 4

          "...one key functionality is not working..."

           

          What functionality, then?

          • 2. Re: Phonegap Build App not working when hydra is disabled
            venkyr81192151 Level 1

            Hi VectorP,

             

            Thanks for your reply. Audio is not working. Audio is called using js.

             

            Regards,

            Venkat

            • 3. Re: Phonegap Build App not working when hydra is disabled
              VectorP Level 4

              Are you using the Media plugin to play your audio?

              If not, your CSP (or lack thereof) might prevent the inline script to be used.

              • 4. Re: Phonegap Build App not working when hydra is disabled
                kerrishotts Adobe Community Professional

                Please share some code so we can see exactly how you're trying to generate audio. Also share where your audio assets are located in your project.

                 

                Also -- IIRC, hydration is going to be placing files in a different location, so it's possible that how you're using audio is taking advantage of something hydration was doing. Without seeing your code, it's hard to say.

                • 5. Re: Phonegap Build App not working when hydra is disabled
                  venkyr81192151 Level 1

                  No, I am not using any Media plugin.

                   

                  I have added

                   

                  1) cordova-plugin-whitelist.

                   

                  2) I have also added required information in allow-navigation, allow-intent & access origin.

                   

                  3) Have added below line in html header.

                   

                  <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' media-src *  "/>

                   

                  Not sure if this is a permission issue or any other issue.

                  • 6. Re: Phonegap Build App not working when hydra is disabled
                    VectorP Level 4

                    You are quite sparse when it comes to supplying information:

                    - in the thread title, you say "Phonegap Build App not working" (without saying what it is that is 'not working' and how you think it should 'work')

                    - then it's "one key functionality" that "doesn't work", without mentioning the functionality itself

                    - now you say you have "added required information in allow-navigation, allow-intent & access origin", without mentioning any code, so nobody here can check whether or not that piece contains any errors.

                    - Kerri asked: Please share some code so we can see exactly how you're trying to generate audio. Also share where your audio assets are located in your project., but no reply yet.

                     

                    How can we possibly be of any help?

                    • 7. Re: Phonegap Build App not working when hydra is disabled
                      venkyr81192151 Level 1

                      Sorry about that, I have message you everything in detail, hope it help to know more about the issue or identify root cause of this issue. Once again thanks for your time and reply Vector! !

                      • 8. Re: Phonegap Build App not working when hydra is disabled
                        VectorP Level 4

                        By sending your reply privately, you are defeating the purpose of this public forum and you are limiting the number of useful reply from others. The purpose is to make everyone participate, so:

                        - you receive the best possible ideas

                        - others can learn or find this thread later on

                         

                        Anyway, there are a couple of strange things in your package. These may not be relevant for the current audio problem, though:

                         

                        a. You have included the whitelist plugin twice

                        b. You are using old, deprecated plugins from the pgb repo. Use the latest versions from npm instead

                        c. You specify a non-existing path for icons and splashes

                        d. Many icon/splash dimensions for iOS and Android are missing

                         

                        e. You are including references to both cordova.js and phonegap.js

                        Remove the reference to phonegap.js

                         

                        In your function 'play_audio' you have:

                        $(audio_selector)[0].play();

                        Have you checked whether $(audio_selector), $(audio_selector)[0] and $(audio_selector)[0].play(); exist at that time?

                        If not, do you get any javascript error messages while testing?

                         

                        In other words: you said your issue is that the sound doesn't play. Most likely, yu just tested as a user would: click the button and hope for the best. However, as a developer, you need to debug: find the code line that fails! Put checkpoints (or, if nothing else helps, put alerts) at relevant points in your code and see whether or not those pieces are correctly executed. That way, you can isolate the issue to (hopefully) one single code line, which in turn will make you realize the cause of the problem.

                        • 9. Re: Phonegap Build App not working when hydra is disabled
                          kerrishotts Adobe Community Professional

                          What devices & platforms (and OS versions) is the audio failing on? Please be specific -- sometimes device/platform-specific stuff gets in the way and mucks up all of our best intentions! ;-)

                           

                          Also do you get the initial sound when you start the app on the device? Do later sounds play or fail to play? I'm assuming no sounds what-so-ever, but when debugging, one needs to be certain of the specifics.