Yes, you can enjoy your music while charging Beoplay P2. However, if the battery level is below 15%, you need to allow time for the battery to hold sufficient charge before you can play at high volume.
In general, battery life depends on the volume level and intensity of the music and equalizer setting. This means that the battery drains faster at higher volume when playing higher intensity music, like rock or heavy metal.