iOS gives a warning in the console log

I’m using a simple Media call such as:

var mymusic = new Media(SRC); 
    mymusic.play();

And I see in the console, this warning:

THREAD WARNING: ['Media'] took '22.630859' ms. Plugin should use a background thread

Now, the time is high ( 22ms ) because I accidentally did something like this ( since I had problems loading the Media file and did this to debug it ):

function prepare_music() {
    var mymusic = new Media(SRC); 
        mymusic.play();
return mymusic;
}

var song1 = prepare_music();
    song1.play()

And it got me thinking - if it played it twice, how’s that I didn’t hear it twice ?! I only heard my first click to play the music.
Removing the “mymusic.play();” from the function, lowered the time to 16ms ( and I still see the warning )

So,

  1. I read in PhoneGap that Apple doesn’t like UI blockers, so I wonder if this is a concern.
  2. How do I take something to the background ?
  3. How do I play/overlap the music ? ( like playing 2 sounds, one for background music, 2nd for clicks and stuff … )
1 Like

I have this :

THREAD WARNING: ['<PLUGIN NAME>'] took '16.912842' ms. Plugin should use a background thread.

I have this warning in Xcode too, with many plugins… I am looking for a way to use these plugins correctly.
Any help are welcome !!

+1

THREAD WARNING: ['Console'] took '12.437012' ms. Plugin should use a background thread.
1 Like

Has anyone found solution for this?