Skip to content

Feat: Comprehensive upgrade of Smart Speed to context-aware engine (#1463)#3628

Open
AryaXDG wants to merge 1 commit intocode-charity:masterfrom
AryaXDG:feat/smart-speed-upgrade
Open

Feat: Comprehensive upgrade of Smart Speed to context-aware engine (#1463)#3628
AryaXDG wants to merge 1 commit intocode-charity:masterfrom
AryaXDG:feat/smart-speed-upgrade

Conversation

@AryaXDG
Copy link
Contributor

@AryaXDG AryaXDG commented Feb 19, 2026

This Pull Request represents a significant evolution of the "Smart Speed" feature. It transitions the implementation from a basic heuristic toggle to a mature, context-aware engine. The core logic has been overhauled to prioritize mathematical smoothing, granular user customization, and resilient data extraction while adhering to strict security policies.

The upgraded engine incorporates the following technical enhancements:

  1. Baseline Speed Integration: The playback rate is now calculated as a relative multiplier applied to the user's current manual speed setting (playbackRate = baseSpeed * smartMultiplier).
  2. Linear Interpolation (LERP) Smoothing: Implemented a 2.5-second lookahead buffer. The engine utilizes a linear interpolation algorithm to execute frame-perfect speed transitions, eliminating acoustic artifacts and abrupt frequency shifts.
  3. Greedy Fractional Knapsack Implementation: Introduced "Target Duration Mode." This utilizes an optimization algorithm to distribute maximum speed increases across the lowest-engagement segments to fit the video into a precise user-defined time budget.
  4. Resilient Recursive Data Extraction: Re-engineered the heatmap hunting logic using a 3-tier recursive strategy. This traverses arbitrary JSON structures for MARKER_TYPE_HEATMAP identifiers, ensuring durability against YouTube's frequent internal metadata schema updates.
  5. Contextual Profile Management: Developed a dynamic dashboard within the Satus framework allowing for persistent, per-channel and per-category configuration overrides (Min Speed, Max Speed, Sensitivity, and Whitelisting).

Key Changes:

Logic Engine (player.js):

  • State Management: Encapsulated session states, including sessionDisabled toggles and rawMarkersCache to prevent redundant network requests.
  • Security Compliance: Completely refactored DOM injection to utilize document.createElementNS and setAttribute. This ensures 100% compliance with YouTube's strict TrustedHTML Content Security Policy (CSP), preventing execution blocks.
  • Fallback Logic: Hardcoded smart defaults for specific genres; "Music" is whitelisted by default to preserve temporal integrity, while "Education" is clamped to ensure intelligible speech processing.

User Interface (menu/skeleton-parts/player.js):

  • Dynamic Satus Rendering: Implemented a recursive UI refresh function to handle real-time profile creation and deletion.
  • Unique Key Identifiers: Added timestamp-based key generation for UI components to circumvent Satus virtual DOM caching conflicts.
  • Category Integration: Integrated a comprehensive dropdown utilizing native YouTube category IDs.

In-Player Controls:

  • Native Control Bar Integration: Injected functional controls into .ytp-right-controls.
  • Telemetry Display: Real-time speed indicator with integrated session kill-switch logic.
  • Whitelist Toggle: Persistent shield control to instantly exclude the current channel from the Smart Speed logic loop.
  • Peak Seek: Logic to detect the next local maximum in the engagement array and seek to T - 2.0s.

Localization (_locales/en/messages.json):

  • Defined all required string keys for internationalization, ensuring no hardcoded strings exist within the source code.

Technical Implementation Details:

  • Asynchronous Data Handling: Utilizes async/await for Tier 3 background fetches to prevent main-thread blocking during JSON parsing.
  • Visual Feedback System: Implemented a non-intrusive toast notification system using CSS transitions for state-change confirmation.
  • Event Lifecycle: Hooks into yt-navigate-finish and loadeddata for reliable state resets during Single Page Application (SPA) transitions.

Screenshots:

1. Satus Profile Manager & Configuration
categories- -channels profile

2. Core Settings Dashboard
main-menu

3. Native Player Control Integration
yt-player-layout-buttons


Testing Environment:

  • Operating System: Linux Debian
  • Browser: Google Chrome (Stable)
  • Verification: Confirmed functional parity across various content genres, validated CSP compliance, and verified recursive extraction on videos with obfuscated PlayerResponse objects.

Related Issue:
Closes #1463

This update transforms the basic Smart Speed toggle into a fully mature engine. Changes include:
- LERP-based audio smoothing for seamless speed transitions
- Target Duration Mode (Fractional Knapsack algorithm)
- In-player UI controls for Next Peak, Target Duration, and Whitelist toggles
- Dedicated Profile Manager in Satus settings for Category/Channel overrides
- Safe DOM injection bypassing YouTube's TrustedHTML policy
@AryaXDG AryaXDG changed the title feat(player): completely overhaul Smart Speed Feat: Comprehensive upgrade of Smart Speed to context-aware engine (#1463) Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Youtube's Timeline Heatmap (Histogram) enables/improves a lot...

1 participant

Comments