Implement Plyr-based video player with comprehensive YouTube UI blocking

Rewrote VideoPlayerWithChapters component using plyr-react with best practices:
- Use Plyr React component wrapper for proper integration
- Aggressive YouTube UI hiding with correct parameters (controls=0, disablekb=1, fs=0)
- Block right-click context menu globally
- Block developer tools shortcuts (F12, Ctrl+Shift+I/J, Ctrl+U)
- CSS pointer-events manipulation to block YouTube iframe interactions
- Only Plyr controls remain interactive
- Accurate time tracking via Plyr's timeupdate event
- Chapter jump functionality via Plyr's currentTime API
- Custom accent color support for Plyr controls
- Hide YouTube's native play button with ::after overlay

This implementation provides:
 Working timeline with accurate duration tracking
 Chapter navigation that jumps to correct timestamps
 Maximum prevention of YouTube UI access
 Custom Plyr controls with your accent color
 Right-click and dev tools blocking
 No "Watch on YouTube" or copy link buttons
 Clean user experience

Based on recommended plyr-react implementation patterns.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-01-01 10:30:45 +07:00
parent 314cfa6c65
commit 7c6d335fa1
3 changed files with 191 additions and 180 deletions

15
package-lock.json generated
View File

@@ -59,6 +59,7 @@
"lowlight": "^3.3.0",
"lucide-react": "^0.462.0",
"next-themes": "^0.3.0",
"plyr": "^3.8.3",
"plyr-react": "^6.0.0",
"qrcode.react": "^4.2.0",
"react": "^18.3.1",
@@ -4261,7 +4262,6 @@
"integrity": "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==",
"hasInstallScript": true,
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
@@ -4308,8 +4308,7 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/custom-event-polyfill/-/custom-event-polyfill-1.0.7.tgz",
"integrity": "sha512-TDDkd5DkaZxZFM8p+1I3yAlvM3rSr1wbrOliG4yJiwinMZN8z/iGL7BTlDkrJcYTmgUSb4ywVCc3ZaUtOtC76w==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/d3-array": {
"version": "3.2.4",
@@ -5397,8 +5396,7 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/loadjs/-/loadjs-4.3.0.tgz",
"integrity": "sha512-vNX4ZZLJBeDEOBvdr2v/F+0aN5oMuPu7JTqrMwp+DtgK+AryOlpy6Xtm2/HpNr+azEa828oQjOtWsB6iDtSfSQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/locate-path": {
"version": "6.0.0",
@@ -6249,7 +6247,6 @@
"resolved": "https://registry.npmjs.org/plyr/-/plyr-3.8.3.tgz",
"integrity": "sha512-0+iI5uw0WRvtKBpgPCkmQQv7ucHVQKTEo6UFJjgJ8cy/JZhy0dQqshHQVitHXV6l2O3MzhgnuvQ95VSkWcWeSw==",
"license": "MIT",
"peer": true,
"dependencies": {
"core-js": "^3.45.1",
"custom-event-polyfill": "^1.0.7",
@@ -6691,8 +6688,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/rangetouch/-/rangetouch-2.0.1.tgz",
"integrity": "sha512-sln+pNSc8NGaHoLzwNBssFSf/rSYkqeBXzX1AtJlkJiUaVSJSbRAWJk+4omsXkN+EJalzkZhWQ3th1m0FpR5xA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/react": {
"version": "18.3.1",
@@ -7538,8 +7534,7 @@
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/url-polyfill/-/url-polyfill-1.1.14.tgz",
"integrity": "sha512-p4f3TTAG6ADVF3mwbXw7hGw+QJyw5CnNGvYh5fCuQQZIiuKUswqcznyV3pGDP9j0TSmC4UvRKm8kl1QsX1diiQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/use-callback-ref": {
"version": "1.3.3",