Problems merging 2 codes (blinking light and dfplayer)

I expect that what is happening now is that loop is calling the play function repeatedly and restarting the track before it actuallyproduced anything audible. Previously, the delay was avoiding that, but at the cost of stopping the LEDs working.

I can see two ways to fix it. The right way is probably to have a look at your library and find something that you can use to check whether the device is playing something. If it is, don't kick it off again. There is no obvious IsPlaying function, but you may be able to get something from readStatus that will tell you what you need to know.

The other way is a bit of a hack - you can use millis for timing and because you know how long your track is, you can ensure that six seconds have passed before checking the PIR again.

This latter method is illustrated by the Blink without delay example that comes with the IDE. There's also a long post about it in the tutorials section called " Using millis() for timing. A beginners guide"