If you're someone who goes to bed in total silence each night, it might seem weird that a service like YouTube is adding a sleep timer. You watch YouTube videos when you're awake, not when you're going to sleep! But look, some of us actually need something—anything!—playing in the background in order to fall asleep each night, and YouTube is kind of the perfect tool for that: The service has a virtually unlimited supply of long, monotone videos to play to help lull you to slumber. The problem is, some of them are so long, you run the risk of waking up with the video still playing.
That's where a sleep timer can be helpful: If you know it takes you about 20 minutes to fall asleep, you can set your sleep timer for 20 minutes (maybe a bit more to be safe). Once the timer has elapsed, your playback stops, your computer can go to sleep, and you won't have to worry about wasting energy or being jarred awake by a blaring ad break.
Before today, YouTube had tested this feature with Premium subscribers only. If you paid for YouTube, you could go to YouTube's experimental features page, enable the option, and enjoy another perk to your subscription.
However, now all of us should find the Sleep Timer option in our YouTube apps, regardless of our account status. Once the feature rolls out to you, you'll access it by tapping the settings gear on any video you play. You can set the timer for 10, 15, 20, 30, 45, or 60 minutes, or for the length of the video.
You don't need to rely on YouTube's sleep timer, however. If you have an iPhone, you have a built-in sleep timer you can use for any media playback. To use it, open the Clock app then tap the Timers tab. Set your timer for any length of time you want, then tap When Timer Ends. Scroll to the bottom, and choose Stop Playing. Start your timer, then play a video on YouTube. Once your timer runs out, your iPhone will stop playback and lock itself, so you won't wake up or lose extra battery life.
If you're on Android, there isn't quite the same built-in equivalent. Your best bet may be to download a third-party app designed for the task, such as Sleep Timer from Kuczera. If you have a Samsung device, this Reddit post also walks through a possible automation you could set up to stop playback after a certain period of time:
Open Modes and Routines.
Tap Routines in the bottom-right, then choose the plus icon in the top-right.
In the "If" section, choose the "Start manually" command.
In the "Then" section, add the "Wait before next action" command. This is where you can choose how long the timer will last.
Back in the "Then" section, add the "Close an app" command, then select the app you want to close. In this case, that's YouTube.
Name the routine, then hit Save.
Whenever you want to start the timer, hit Play.