Playing audio doesn't require the screen, so the Music app only requests the system to avoid the computer going to sleep, not turning off the screen.
YouTube plays video, so that would require the screen to stay on.
The whole thing is quite consistent.
pmset can be used to check what's preventing what, in Terminal.app write
pmset -g
and press enter.