/** * Next.js / React компонент для встраивания RUTUBE-видео. * * Использование: * * * Или с кастомными параметрами: * * * Партнёрский `dist` берётся из env-переменной NEXT_PUBLIC_RUTUBE_DIST. * Положите в .env.local: * NEXT_PUBLIC_RUTUBE_DIST=shkulevmedia_2 */ import { useEffect, useMemo } from 'react'; interface RutubeEmbedProps { videoId: string; width?: number | string; height?: number | string; autoplay?: boolean; mute?: boolean; noAds?: boolean; className?: string; } export function RutubeEmbed({ videoId, width = 720, height = 405, autoplay = true, mute = true, noAds = false, className, }: RutubeEmbedProps) { const src = useMemo(() => { const params = new URLSearchParams({ dist: process.env.NEXT_PUBLIC_RUTUBE_DIST || '', anc: typeof window !== 'undefined' ? window.location.hostname : '', tp: 'web', autoplay: String(autoplay), autostartmute: String(mute), ...(noAds && { referer: 'embed.noads' }), }); return `https://rutube.ru/play/embed/${encodeURIComponent(videoId)}/?${params}`; }, [videoId, autoplay, mute, noAds]); return (