Search code examples
androidcordovasplash-screen

How to add background music in splash activty in cordova?


I am creating new android application using cordova. I have used splash screen in the application that is working fine, but now I want to add some background music while splash screen is on. So how to do that?


Solution

  • You have a few different options. You could add an audio file directly into your index.html file and have it autostart when it's finished decoding, but I highly recommend against that as it can create a poor experience for the user.

    I would recommend adding audio in your javascript code with howler.js and then playing it after it's finished decoding && deviceReady has fired, that way it creates a much more consistent experience.