Is it possible to Play Audio from a Media Player when the Screen is locked on Android?

Through the “Application Will Deactivate Delegate” I’m able to start a media player when the app is being put into the background, by pressing the home button or similar, and I can start an audio track.

It should also keep on running when the screen is locked to save energy while using the application. When locking the Screen (Pressing the lock Button on the side of the device) the “Application Will Deactivate Delegate” is being called successfully but the audio does not start.

In both cases the PLAY function return this Warning:
LogAndroidMedia: Warning: Cannot set rate while closed, preparing, or in error state

And the result boolean is false too.
Is there a way to get this to work when a screen is locked? Or did I stumble accross a bugg and it isn’t even supposed to be able to play a sound when it is in the background?

Any information about how playing audio with a locked device could work would be really appreciated!

I think, ue4 media player working only if app open (I could be wrong).
But if you want to play music in background , you must use native Android service MediaPlayer with background player. Something like this:
https://developer.android.com/guide/topics/media/mediaplayer#mpandservices

But it can be very time-consuming.