Include (sleep)timer in app?

Hello,

I revived the MP3-Player app.
As I plan to use it as “streaming client” for the kids, I am thinking about a sleep/timer function.

any suggestion on how to start?
on idea was to set the end-time (from intern or even from another user) in the DB and use something similar to the heartbeat to read and compare the timer every x minutes.
when the time is reached, stop the streaming.

does this make sense?
Any other suggestion - or perhaps reusables?