YouTube Playback (XInput)

Xbox controller playback for YouTube with hold-to-repeat

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

Аўтар
kidpoleon
Усталяванняў за дзень
0
Усяго ўсталяванняў
1
Рэйтынг
0 0 0
Версія
1.0
Створаны
16.06.2026
Абноўлены
16.06.2026
Памер
9.9 КБ
Ліцэнзія
MIT
Ужываецца на

YouTube Playback (XInput)

Description

Advanced Xbox controller support for YouTube with hold-to-repeat functionality. Control YouTube playback using your gamepad with precise seek, volume, and navigation controls.

Features

  • Full Controller Support: Maps Xbox controller buttons to YouTube playback controls
  • Hold-to-Repeat: Hold directional buttons and triggers for continuous action
  • Focus Detection: Only responds to input when YouTube tab is active and focused
  • Volume Overlay: D-Pad volume controls show YouTube's native volume overlay
  • Frame-by-Frame: Precise frame stepping using LT/RT triggers
  • Quick Access: Toggle fullscreen, comments sidebar, and stats for nerds

Controller Mapping

Face Buttons

  • A: Play/Pause
  • B: Toggle Subtitles (Closed Captions)
  • X: Mute/Unmute
  • Y: Toggle Fullscreen

D-Pad

  • Up: Volume Up (+5%) - Shows overlay
  • Down: Volume Down (-5%) - Shows overlay
  • Left: Seek Backward 5 seconds
  • Right: Seek Forward 5 seconds

Shoulder Buttons

  • LB: Seek Backward 1 second (hold-to-repeat)
  • RB: Seek Forward 1 second (hold-to-repeat)

Triggers

  • LT: Frame Backward (auto-pauses, hold-to-repeat)
  • RT: Frame Forward (auto-pauses, hold-to-repeat)

Center Buttons

  • Select: Previous Video / Previous in Playlist (Shift+P)
  • Start: Next Video / Next in Playlist (Shift+N)

Thumbsticks

  • L3 (Left Stick Click): Toggle Picture-in-Picture
  • R3 (Right Stick Click): Toggle Comment Sidebar (fullscreen mode)

Technical Details

  • Hold-to-Repeat: 400ms initial delay, 100ms repeat rate (10 actions/second)
  • Focus Protection: Uses document.hasFocus() and visibilityState API
  • No Permissions: Runs entirely within page context
  • Performance: Uses requestAnimationFrame for efficient polling
  • Playlist Support: Works with YouTube playlists and mixes using native keyboard shortcuts

Browser Compatibility

This script has been tested and optimized for Firefox (Gecko). While it may work on other browsers, functionality on Chromium-based or WebKit-based browsers is not guaranteed.

Requirements

  • Modern browser with Gamepad API support
  • Xbox controller (XInput compatible)
  • Userscript manager (Tampermonkey, Greasemonkey, Violentmonkey, etc.)

Installation

  1. Install a userscript manager extension
  2. Click "Install this script" on GreasyFork
  3. Connect your Xbox controller
  4. Navigate to YouTube and start using

Notes

  • Controller input is ignored when YouTube is running in background tabs
  • Frame stepping automatically pauses the video
  • Comment sidebar toggle works in fullscreen mode on modern YouTube layout
  • START button navigates to next video or next in playlist
  • SELECT button navigates to previous video or previous in playlist
  • Fullscreen toggle works without requiring mouse interaction with video area
  • Picture-in-Picture toggle uses HTML5 PiP API for reliable operation

License

MIT License - Free to use, modify, and distribute

Author

kidpoleon