The short answer

In YouTube’s own player, changing the playback speed does not change the pitch. A video at half speed sounds slower, but not lower. People expect the other result because of tape and vinyl, where slower really does mean lower.

Why the browser can do this

Web video and audio elements can stretch time while holding the pitch. The setting is called preserve pitch, and it is on by default. The browser rearranges the sound as it plays, so the notes keep their height at any speed.

When the pitch does follow the speed

Some players and apps switch pitch preservation off and play like a turntable, and some audio tools offer both choices. If you ever hear a recording go lower as it slows, the player you are using has that turned off.

Keeping it fixed everywhere

PitchShed sets the preserve-pitch option on the video itself, so the speed control behaves the same on any page with a standard video or audio element. And if you do want the pitch to change, you ask for it with the Key control, in whole semitones, separately from the speed.

Changing the pitch on purpose

The two controls are independent. Speed changes the tempo, Key changes the pitch, and you can set any combination: a song at 80 % speed and two semitones lower. The page on slowing a video without changing the pitch covers the speed side.

A quick test you can run

To hear it for yourself, play a video with a held note, such as a sustained vocal or a synthesizer. Set the speed to half. The note stays at the same height while the rhythm slows. If the note falls, the player is not preserving pitch.