Interactive Player Test Suite
contextmenu) and dragging are suppressed across all surfaces to shield raw video URLs from browser right-click copying. External third-party browser extension content scripts (such as content-youtube-embed.js) are trapped to maintain seamless execution.
Developer UI Models & Design Presets
Choose from 6 production-grade design presets tailored for specific sectors. Clicking any card immediately applies typography, backdrop blur, control geometry, and accent tokens to the live player above.
Floating frosted-glass dock with 24px backdrop blur, translucent borders, and ambient electric cyan glow.
Distraction-free floating pill dock with pure monochrome white highlights and slender 3px seeker track.
Broadcast workstation console with dark charcoal matte, studio amber tally, and monospace timecode.
Futuristic HUD console with sharp angular lines, high-tech status indicators, and neon cyan glow.
Pure pitch-black canvas with warm champagne gold accent and subtle cinematic edge softness for movies.
Standard neutral dark zinc video player with signature video red accent and balanced contrast.
Customization Studio & Live Code Generator
// Loading snippet...
Developer Implementation Guide
The player engine includes a robust parser that accepts any standard YouTube link format, timestamp, or video ID.
1 Supported URL Formats
You can pass full watch links, short URLs, embed links, Shorts, or bare IDs:
// Standard watch URL:
player.load('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
// Short link (youtu.be):
player.load('https://youtu.be/dQw4w9WgXcQ');
// With timestamp (e.g. start at 1m 25s):
player.load('https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=85s');
// Bare 11-character video ID:
player.load('dQw4w9WgXcQ');
2 Programmatic Start Timestamps
Provide an explicit starting offset in seconds as the second argument to player.load():
// Start playback at 45 seconds:
player.load('dQw4w9WgXcQ', 45);
How to protect paid course videos, SaaS content, and membership video assets from user scraping.
1 Context Menu & Click Interceptor
The player automatically places an invisible click-shield layer over the video and suppresses contextmenu events. Right-clicking or dragging the video will never show YouTube's "Copy video URL" or redirect to external pages.
2 Stream Token Obfuscation (b64:...)
Instead of placing raw YouTube IDs in the HTML, generate protected stream tokens on your backend and send them to the client:
// Node.js Backend API Route:
function createToken(videoId, startSec = 0) {
const payload = startSec > 0 ? `${videoId}?t=${startSec}` : videoId;
return 'b64:' + Buffer.from(payload).toString('base64');
}
// Client Application:
player.load('b64:ZFF3NHc5V2dYY1E/dD0w');
// DOM inspector shows only: <div data-stream="b64:...">
3 Smart Ad Passthrough
While external clicks are shielded during normal video playback, the engine monitors player state. If an advertisement appears, pointer events are automatically unlocked directly onto the iframe so users can click "Skip Ad". Once the ad ends, security shielding re-locks instantly.
Implementation patterns for React, Next.js, Vue 3, Svelte, and Native HTML.
1 React / Next.js Hook & Component
import React, { useEffect, useRef } from 'react';
import { createPlayer } from '@researcher-tizar/cyp-player';
import '@researcher-tizar/cyp-player/dist/player.css';
export function MyVideo({ videoId }) {
const containerRef = useRef(null);
const playerRef = useRef(null);
useEffect(() => {
if (!containerRef.current) return;
const player = createPlayer({
element: containerRef.current,
videoId,
preset: 'glass',
lazy: true
});
playerRef.current = player;
return () => player.destroy();
}, [videoId]);
return <div ref={containerRef} className="aspect-video w-full" />;
}
2 Autonomous Web Component
<!-- Import bundle -->
<script type="module" src="custom-youtube-player/dist/player.es.js"></script>
<link rel="stylesheet" href="custom-youtube-player/dist/player.css">
<!-- Use anywhere in HTML -->
<custom-youtube-player video-id="dQw4w9WgXcQ" preset="cinema" lazy="true">
</custom-youtube-player>
Easily extend the player with built-in or custom plugins using our lightweight plugin interface.
1 Built-In Plugins
import {
createPlayer,
resumePlugin,
chaptersPlugin,
keyboardPlugin,
gesturesPlugin
} from '@researcher-tizar/cyp-player';
const player = createPlayer({
element: '#player',
videoId: 'dQw4w9WgXcQ',
plugins: [
resumePlugin(), // Remembers position in localStorage
keyboardPlugin(), // Space, J, K, L, M, F, T shortcuts
gesturesPlugin(), // Mobile double-tap left/right seeking
chaptersPlugin({ // Chapter markers & drawer
chapters: [
{ time: 0, title: 'Intro' },
{ time: 45, title: 'Deep Dive' }
]
})
]
});
2 Writing a Custom Plugin
const analyticsPlugin = () => ({
name: 'analytics',
install(player) {
player.on('playing', () => console.log('Playback started'));
player.on('ended', () => console.log('Playback finished'));
},
destroy(player) {
// cleanup
}
});
player.use(analyticsPlugin());
Public API Reference
| Method | Parameters | Description |
|---|---|---|
| player.play() | None |
Starts or resumes playback. Returns Promise. |
| player.pause() | None |
Pauses video playback. |
| player.togglePlay() | None |
Toggles playback state between play and pause. |
| player.seekTo(sec) | seconds: number |
Seeks to an exact timestamp in seconds. |
| player.seekBy(offset) | offsetSeconds: number |
Seeks relative to current playback position (e.g. +10 or -10). |
| player.setVolume(val) | volume: 0..100 |
Adjusts player audio volume. |
| player.setPlaybackRate(r) | rate: 0.5..2.0 |
Sets playback speed rate (0.5, 0.75, 1, 1.25, 1.5, 1.75, 2). |
| player.load(target, sec?) | target: string, start?: number |
Loads a new video by URL, video ID, or b64:... token. |
| player.applyPreset(name) | preset: 'glass'|'minimal'|... |
Applies complete design model preset dynamically. |
| player.destroy() | None |
Cleans up timers, event listeners, plugins, and removes DOM elements. |
Autonomous Native Web Component Showcase
Zero-setup Custom Element that works directly in vanilla HTML or any modern framework without wrapper libraries.
Supports reactive attributes: src, video-id, preset, theme, accent-color, and radius.