11"use client" ;
22
3+ import { useState } from "react" ;
4+ import { ExternalLink , Shield } from "lucide-react" ;
5+
6+ function PlayerFrame ( { src, adGuardDoH } : { src : string ; adGuardDoH : string } ) {
7+ const [ iframeEnabled , setIframeEnabled ] = useState ( false ) ;
8+
9+ return (
10+ < div className = "space-y-3" >
11+ < div className = "relative w-full aspect-video bg-black rounded-xl overflow-hidden" >
12+ < iframe
13+ src = { src }
14+ className = { `absolute inset-0 w-full h-full ${
15+ iframeEnabled ? "pointer-events-auto" : "pointer-events-none"
16+ } `}
17+ allowFullScreen
18+ allow = "autoplay; fullscreen; picture-in-picture; encrypted-media"
19+ referrerPolicy = "origin"
20+ title = "Player"
21+ />
22+
23+ { ! iframeEnabled && (
24+ < div className = "absolute inset-0 z-10 flex items-center justify-center bg-black/70 backdrop-blur-xs" >
25+ < div className = "text-center px-4 max-w-md space-y-3" >
26+ < p className = "text-sm sm:text-base text-foreground/90" >
27+ Click once to enable the player. This first click stays in-app to
28+ reduce popup triggers from the embed.
29+ </ p >
30+ < button
31+ onClick = { ( ) => setIframeEnabled ( true ) }
32+ className = "inline-flex items-center gap-2 h-10 px-4 rounded-lg bg-accent-red text-white text-sm font-medium hover:bg-accent-red/90 transition-colors cursor-pointer"
33+ >
34+ Enable Player
35+ </ button >
36+ < a
37+ href = { src }
38+ target = "_blank"
39+ rel = "noreferrer"
40+ className = "inline-flex items-center gap-1 text-xs sm:text-sm text-foreground/70 hover:text-foreground transition-colors"
41+ >
42+ Open player in new tab
43+ < ExternalLink className = "h-3.5 w-3.5" />
44+ </ a >
45+ </ div >
46+ </ div >
47+ ) }
48+ </ div >
49+
50+ < div className = "flex flex-wrap items-center gap-2 rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-xs text-muted-foreground" >
51+ < Shield className = "h-3.5 w-3.5 text-accent-red" />
52+ < span >
53+ For stronger ad blocking, configure DNS-over-HTTPS to
54+ < span className = "text-foreground" > dns.adguard-dns.com</ span > .
55+ </ span >
56+ < a
57+ href = { adGuardDoH }
58+ target = "_blank"
59+ rel = "noreferrer"
60+ className = "inline-flex items-center gap-1 text-foreground/80 hover:text-foreground"
61+ >
62+ Endpoint
63+ < ExternalLink className = "h-3.5 w-3.5" />
64+ </ a >
65+ </ div >
66+ </ div >
67+ ) ;
68+ }
69+
370export default function Player ( {
471 tmdbId,
572 type = "movie" ,
@@ -20,16 +87,6 @@ export default function Player({
2087 src = `https://player.videasy.net/movie/${ tmdbId } ` ;
2188 }
2289
23- return (
24- < div className = "relative w-full aspect-video bg-black rounded-xl overflow-hidden" >
25- < iframe
26- src = { src }
27- className = "absolute inset-0 w-full h-full"
28- allowFullScreen
29- allow = "autoplay; fullscreen; picture-in-picture; encrypted-media"
30- referrerPolicy = "origin"
31- title = "Player"
32- />
33- </ div >
34- ) ;
90+ const adGuardDoH = "https://dns.adguard-dns.com/dns-query" ;
91+ return < PlayerFrame key = { src } src = { src } adGuardDoH = { adGuardDoH } /> ;
3592}
0 commit comments