However, as easy as this may be it comes with a drawback. While the delay is counting down the hour, if you restart Home Assistant or execute Reload Automations during the countdown it will cancel the delay and terminate the script. In other words, the script never gets to turn off the media_player.
There’s a way to mitigate this behavior, ensuring the media_player is turned off even after a restart/reload, but it introduces additional complexity (requires a Timer helper and an automation).
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.