From 36f83ff72c517e49f761949abdb686d964ae6c27 Mon Sep 17 00:00:00 2001 From: hibna Date: Mon, 3 Nov 2025 02:35:56 +0300 Subject: [PATCH] Add SRT/FLV/RTMP support and update documentation Introduced Python scripts for SRT subtitle checking and fixing, and added comprehensive documentation covering advanced features such as protocol detection, subtitle/audio/quality management, keyboard shortcuts, and touch gestures. Updated local settings to allow new build and Python commands, added TypeScript definitions for FLV, and implemented RTMP/FLV protocol support in the player. Removed CHANGELOG.md and made various improvements to styles and example app. --- .claude/settings.local.json | 6 +- CHANGELOG.md | 70 - DOCUMENTATION.md | 3386 ++++++++++++------ __pycache__/check_srt.cpython-311.pyc | Bin 0 -> 6017 bytes check_srt.py | 109 + comprehensive_srt_check.py | 281 ++ examples/App.tsx | 6 +- fix_srt.py | 187 + package.json | 5 +- src/components/ControlsLayer.css | 5 + src/components/VideoElement.tsx | 163 +- src/components/VideoPlayer.tsx | 19 +- src/components/controls/CenterPlayButton.css | 24 +- src/components/controls/ProgressBar.css | 12 +- src/components/controls/VolumeControl.css | 22 +- src/components/overlays/LoadingSpinner.css | 3 +- src/flv.d.ts | 9 + src/types/index.ts | 2 + src/utils/hlsLoader.ts | 64 +- src/utils/hlsSetup.ts | 62 +- src/utils/m3u8Parser.ts | 88 +- src/utils/rtmpLoader.ts | 168 + src/utils/rtmpSetup.ts | 240 ++ src/utils/videoProtocol.ts | 110 + vite.config.lib.ts | 3 +- vite.config.ts | 1 + 26 files changed, 3833 insertions(+), 1212 deletions(-) delete mode 100644 CHANGELOG.md create mode 100644 __pycache__/check_srt.cpython-311.pyc create mode 100644 check_srt.py create mode 100644 comprehensive_srt_check.py create mode 100644 fix_srt.py create mode 100644 src/flv.d.ts create mode 100644 src/utils/rtmpLoader.ts create mode 100644 src/utils/rtmpSetup.ts create mode 100644 src/utils/videoProtocol.ts diff --git a/.claude/settings.local.json b/.claude/settings.local.json index aa93a33..7b90019 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -3,7 +3,11 @@ "allow": [ "Bash(find:*)", "Bash(cat:*)", - "Bash(npm run build:*)" + "Bash(npm run build:*)", + "Bash(python check_srt.py:*)", + "Bash(python fix_srt.py:*)", + "Bash(python:*)", + "Bash(pnpm run build:lib:*)" ], "deny": [], "ask": [] diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e63a38e..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,70 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added -- ✅ Test infrastructure with Vitest and React Testing Library -- 🌍 Internationalization (i18n) system with English and Turkish support -- 📊 Comprehensive README with comparison table -- 📝 44 unit tests covering core functionality -- 🔄 Language prop for VideoPlayer component - -### Changed -- 🌐 Replaced hardcoded strings with translation system -- 📦 Updated build configuration for better tree-shaking - -### Fixed -- 🐛 TypeScript errors in test setup file - -## [0.1.3] - 2025-01-29 - -### Changed -- 📦 Fixed CSS export path in package.json -- 🔧 Build configuration improvements - -## [0.1.2] - 2025-01-29 - -### Added -- 📘 TypeScript declaration files support with vite-plugin-dts -- 🎯 Full type safety for all exports - -## [0.1.1] - 2025-01-29 - -### Added -- 🎬 Initial release of Modern Video Player -- ▶️ Core playback controls (play, pause, seek, volume) -- 🎨 Modern, responsive UI with auto-hiding controls -- ⌨️ Comprehensive keyboard shortcuts (15+ shortcuts) -- 📱 Touch gesture support for mobile devices -- 🎞️ HLS streaming support with automatic quality switching -- 📝 Subtitle support (WebVTT and SRT) -- 🎵 Multiple audio track support -- 🖼️ Picture-in-Picture and Fullscreen support -- 🎚️ Playback speed control (0.25x to 2x) -- 🎨 Theme customization with CSS variables -- 🔧 Zero runtime dependencies -- 📦 Tiny bundle size (~15KB gzipped) -- 🔄 HTTP Range Request support for large files -- 🛡️ CORS error handling and helpful error messages -- ⚡ Lazy loading for HLS.js and settings menu -- 🎯 React 18+ support -- 📘 Full TypeScript support - -### Technical Features -- 🏗️ Built with React 18, TypeScript 5, and Vite 7 -- 🎨 CSS modules and CSS variables for styling -- 🧩 Component-based architecture with React Context -- 🪝 Custom hooks for keyboard shortcuts and touch gestures -- 📦 ESM and UMD build outputs -- 🔧 Aggressive bundle optimization with Terser -- 🌲 Tree-shaking support - -[Unreleased]: https://gitea.hibna.com.tr/hibna/video-player/compare/v0.1.3...HEAD -[0.1.3]: https://gitea.hibna.com.tr/hibna/video-player/compare/v0.1.2...v0.1.3 -[0.1.2]: https://gitea.hibna.com.tr/hibna/video-player/compare/v0.1.1...v0.1.2 -[0.1.1]: https://gitea.hibna.com.tr/hibna/video-player/releases/tag/v0.1.1 diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 50e2418..39cc0a2 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1,42 +1,275 @@ -# 📚 Video Player - Kapsamlı Dokümantasyon +# 🎬 @alper/video-player - Tam Dökümantasyon -Modern, hafif ve özellik açısından zengin bir React video player kütüphanesi. Bu dokümantasyon, kütüphaneyi projelerinizde kullanmak için ihtiyacınız olan her şeyi içerir. +**Modern, zengin özellikli ve hafif React video oynatıcı kütüphanesi** + +[![npm version](https://img.shields.io/npm/v/@alper/video-player.svg?style=flat-square)](https://www.npmjs.com/package/@alper/video-player) +[![Bundle Size](https://img.shields.io/bundlephobia/minzip/@alper/video-player?style=flat-square)](https://bundlephobia.com/package/@alper/video-player) +[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue?style=flat-square)](https://www.typescriptlang.org/) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT) + +--- + +## 📑 İçindekiler + +- [Genel Bakış](#-genel-bakış) +- [Kurulum](#-kurulum) + - [NPM/PNPM ile Kurulum](#1-npmpnpm-ile-kurulum) + - [.npmrc Yapılandırması](#2-npmrc-yapılandırması) + - [Kütüphaneyi Yükleme](#3-kütüphaneyi-yükleme) +- [Hızlı Başlangıç](#-hızlı-başlangıç) +- [Mimari ve Yapı](#-mimari-ve-yapı) +- [Özellikler](#-özellikler) + - [Video Format Desteği](#video-format-desteği) + - [Altyazı Sistemi](#altyazı-sistemi) + - [Ses Parça Yönetimi](#ses-parça-yönetimi) + - [Kalite Seviyesi Kontrolü](#kalite-seviyesi-kontrolü) + - [Klavye Kısayolları](#klavye-kısayolları) + - [Dokunmatik Jestler](#dokunmatik-jestler) +- [API Referansı](#-api-referansı) + - [VideoPlayer Props](#videoplayer-props) + - [Exported Components](#exported-components) + - [Exported Hooks](#exported-hooks) + - [Exported Utilities](#exported-utilities) + - [Type Definitions](#type-definitions) +- [Kullanım Örnekleri](#-kullanım-örnekleri) +- [Gelişmiş Kullanım](#-gelişmiş-kullanım) +- [State Yönetimi](#-state-yönetimi) +- [Tema ve Özelleştirme](#-tema-ve-özelleştirme) +- [Uluslararasılaştırma (i18n)](#-uluslararasılaştırma-i18n) +- [Performans](#-performans) +- [Tarayıcı Uyumluluğu](#-tarayıcı-uyumluluğu) +- [Hata Yönetimi](#-hata-yönetimi) +- [Geliştirme](#-geliştirme) +- [Katkıda Bulunma](#-katkıda-bulunma) +- [Lisans](#-lisans) + +--- + +## 🌟 Genel Bakış + +`@alper/video-player`, React uygulamaları için özel olarak tasarlanmış, modern bir video oynatıcı kütüphanesidir. HLS streaming, RTMP/FLV desteği, çoklu altyazı ve ses parçaları, kalite değiştirme ve daha fazlası gibi gelişmiş özellikleri içerir. + +### Neden @alper/video-player? + +| Özellik | @alper/video-player | video.js | react-player | plyr | +|---------|---------------------|----------|--------------|------| +| **Paket Boyutu (gzipped)** | **~15KB** ✅ | ~500KB ❌ | ~50KB ⚠️ | ~30KB ⚠️ | +| **Runtime Bağımlılıkları** | **0** ✅ | Çok ❌ | Az ⚠️ | Az ⚠️ | +| **React Native** | **Evet** ✅ | Wrapper ⚠️ | **Evet** ✅ | Wrapper ⚠️ | +| **TypeScript Native** | **Evet** ✅ | Types ⚠️ | Kısmi ⚠️ | Types ⚠️ | +| **HLS Desteği** | **Evet** ✅ | Evet ✅ | Evet ✅ | Hayır ❌ | +| **RTMP/FLV Desteği** | **Evet** ✅ | Hayır ❌ | Hayır ❌ | Hayır ❌ | +| **Kalite Değiştirme** | **Evet** ✅ | Evet ✅ | Sınırlı ⚠️ | Hayır ❌ | +| **Dokunmatik Jestler** | **15+** ✅ | Sınırlı ⚠️ | Hayır ❌ | Sınırlı ⚠️ | +| **Klavye Kısayolları** | **15+** ✅ | ~8 ⚠️ | Temel ⚠️ | ~10 ⚠️ | +| **i18n Desteği** | **Evet** ✅ | Evet ✅ | Hayır ❌ | Evet ✅ | + +### Ana Avantajlar + +- 📦 **%97 daha küçük** - video.js'e göre sadece 15KB (500KB yerine) +- ⚡ **Çok hızlı** - Sıfır runtime bağımlılık, daha hızlı yükleme +- 🎯 **React-first** - React için özel yapılmış, wrapper değil +- 🔧 **Tam TypeScript** - Box'tan çıktığı gibi tam tip güvenliği +- 🎨 **Kolay özelleştirme** - CSS değişkenleri ile tema desteği +- 📱 **Mobil hazır** - Kapsamlı dokunmatik jest desteği +- 🌍 **Uluslararasılaştırılmış** - İngilizce ve Türkçe yerleşik i18n +- ♿ **Erişilebilir** - ARIA etiketleri ve klavye navigasyonu +- 🎬 **Çoklu format** - MP4, WebM, HLS (.m3u8), RTMP/FLV desteği +- 🔒 **Güvenli** - CORS hatası tespiti ve yardımcı hata mesajları + +--- ## 📦 Kurulum -### NPM ile Kurulum +Bu kütüphane, Gitea üzerinde barındırılan özel bir npm registry'de yayınlanmaktadır. Kurulum için aşağıdaki adımları takip edin. + +### 1. NPM/PNPM ile Kurulum + +Öncelikle projenizde npm veya pnpm kurulu olduğundan emin olun: ```bash -npm install @alper/video-player +# npm kurulu mu kontrol et +npm --version + +# pnpm kurulu mu kontrol et (opsiyonel, hızlı alternatif) +pnpm --version + +# pnpm kurulu değilse +npm install -g pnpm ``` -### Yarn ile Kurulum +### 2. .npmrc Yapılandırması + +`@alper` scope'lu paketlerin Gitea registry'den çekilmesi için projenizin kök dizininde bir `.npmrc` dosyası oluşturmanız gerekir. + +#### Adım 2.1: .npmrc Dosyası Oluşturma + +Projenizin **kök dizininde** (package.json dosyasının bulunduğu yerde) `.npmrc` adlı bir dosya oluşturun: ```bash +# Linux/Mac +touch .npmrc + +# Windows (PowerShell) +New-Item -Path .npmrc -ItemType File +``` + +#### Adım 2.2: .npmrc İçeriği + +`.npmrc` dosyasını aşağıdaki içerikle doldurun: + +```ini +# @alper scope'u için Gitea registry'yi kullan +@alper:registry=https://gitea.hibna.com.tr/api/packages/hibna/npm/ + +# Authentication token +# Token'ınızı almak için: https://gitea.hibna.com.tr/user/settings/applications +# "Generate New Token" butonuna tıklayın ve "read:package" yetkisini seçin +//gitea.hibna.com.tr/api/packages/hibna/npm/:_authToken=YOUR_TOKEN_HERE +``` + +**ÖNEMLİ:** `YOUR_TOKEN_HERE` kısmını kendi Gitea access token'ınız ile değiştirin! + +#### Adım 2.3: Gitea Access Token Alma + +1. Gitea hesabınıza giriş yapın: https://gitea.hibna.com.tr +2. Sağ üst köşeden profil ikonuna tıklayın → **Settings** +3. Sol menüden **Applications** seçeneğine tıklayın +4. **Manage Access Tokens** bölümünde **Generate New Token** butonuna tıklayın +5. Token için bir isim verin (örn: "video-player-npm") +6. **Select permissions** bölümünde şu yetkileri seçin: + - `read:package` - Paketleri okuma yetkisi + - (Yayınlayacaksanız) `write:package` - Paket yayınlama yetkisi +7. **Generate Token** butonuna tıklayın +8. Oluşturulan token'ı kopyalayın (bu token sadece bir kez gösterilir!) +9. Token'ı `.npmrc` dosyasındaki `YOUR_TOKEN_HERE` yerine yapıştırın + +#### Adım 2.4: .npmrc'yi .gitignore'a Ekleyin + +**ÇOK ÖNEMLİ:** Token'ınızı Git'e commit etmeyin! `.npmrc` dosyasını `.gitignore`'a ekleyin: + +```bash +# .gitignore dosyasına ekleyin +echo ".npmrc" >> .gitignore +``` + +`.gitignore` dosyanız şöyle görünmeli: + +``` +node_modules/ +dist/ +.npmrc # ← Bu satırı ekleyin +.env +``` + +#### Alternatif: Environment Variable Kullanımı (Önerilen - Daha Güvenli) + +Daha güvenli bir yöntem için token'ı environment variable olarak saklayabilirsiniz: + +**.npmrc dosyası:** +```ini +@alper:registry=https://gitea.hibna.com.tr/api/packages/hibna/npm/ +//gitea.hibna.com.tr/api/packages/hibna/npm/:_authToken=${GITEA_TOKEN} +``` + +**Environment variable ayarlama:** + +```bash +# Linux/Mac (.bashrc veya .zshrc dosyasına ekleyin) +export GITEA_TOKEN=your-actual-token-here + +# Windows (PowerShell) +$env:GITEA_TOKEN="your-actual-token-here" + +# Windows (Kalıcı - Sistem Environment Variables) +# Sistem Özellikler → Gelişmiş → Ortam Değişkenleri → Yeni +# Değişken adı: GITEA_TOKEN +# Değişken değeri: your-actual-token-here +``` + +**CI/CD için (GitHub Actions, GitLab CI, vb.):** + +Repository settings → Secrets → `GITEA_TOKEN` adında bir secret oluşturun. + +### 3. Kütüphaneyi Yükleme + +`.npmrc` dosyası yapılandırıldıktan sonra, kütüphaneyi yükleyebilirsiniz: + +```bash +# npm ile +npm install @alper/video-player + +# veya pnpm ile (önerilen - daha hızlı) +pnpm add @alper/video-player + +# veya yarn ile yarn add @alper/video-player ``` -### Peer Dependencies +### 4. Peer Dependencies -Video player, React 18+ gerektirmektedir: +Kütüphane, React 18+ gerektirir. Eğer projenizde yoksa: ```bash -npm install react react-dom +npm install react@^18.0.0 react-dom@^18.0.0 +# veya +pnpm add react@^18.0.0 react-dom@^18.0.0 ``` -### Opsiyonel Bağımlılıklar +### 5. Optional Dependencies (Otomatik) -HLS streaming desteği için hls.js otomatik olarak yüklenecektir (gerektiğinde): +HLS ve RTMP/FLV desteği için gerekli kütüphaneler, ihtiyaç duyulduğunda **otomatik olarak lazy-load** edilir: + +- `hls.js` - HLS streaming için (.m3u8 dosyaları) +- `flv.js` - RTMP/FLV streaming için + +Bu kütüphaneler manuel kuruluma gerek yoktur. Ancak bundle size'ı azaltmak için isterseniz kurabilirsiniz: ```bash -npm install hls.js # Opsiyonel +npm install --save-optional hls.js flv.js ``` +### Kurulum Doğrulama + +Kurulumun başarılı olduğunu doğrulamak için: + +```bash +npm list @alper/video-player +# veya +pnpm list @alper/video-player +``` + +Çıktı şöyle olmalı: +``` +your-project@1.0.0 +└─┬ @alper/video-player@0.1.5 +``` + +### Sorun Giderme + +**Problem: "401 Unauthorized" hatası** +- `.npmrc` dosyasındaki token'ın doğru olduğundan emin olun +- Token'ın `read:package` yetkisine sahip olduğundan emin olun +- Token'ın süresi dolmamış olduğundan emin olun + +**Problem: "404 Not Found" hatası** +- Registry URL'inin doğru olduğundan emin olun +- `@alper:registry=https://gitea.hibna.com.tr/api/packages/hibna/npm/` +- İnternet bağlantınızı kontrol edin +- Gitea sunucusunun erişilebilir olduğundan emin olun + +**Problem: "Cannot find module '@alper/video-player'"** +- `node_modules` klasörünü silin ve yeniden yükleyin: + ```bash + rm -rf node_modules package-lock.json + npm install + ``` + --- ## 🚀 Hızlı Başlangıç -### Basit Kullanım +### Temel Kullanım ```tsx import { VideoPlayer } from '@alper/video-player' @@ -52,176 +285,396 @@ function App() { } ``` -### TypeScript Desteği - -Kütüphane tam TypeScript desteğine sahiptir ve tip tanımları otomatik olarak gelir: - -```tsx -import { VideoPlayer, VideoPlayerProps } from '@alper/video-player' -import '@alper/video-player/styles.css' - -const MyPlayer: React.FC = () => { - const props: VideoPlayerProps = { - src: "video.mp4", - autoplay: false, - loop: true, - } - - return -} -``` - ---- - -## 🎬 Özellikler - -### ✅ Temel Özellikler - -- ▶️ **Oynatma Kontrolleri**: Play, pause, seek -- 🔊 **Ses Kontrolü**: Volume slider ve mute -- ⚡ **Hız Kontrolü**: 0.25x - 2x oynatma hızı -- 🔄 **Loop Desteği**: Sürekli tekrar -- 🖼️ **Poster Resmi**: Video başlamadan önce görünen thumbnail -- ⌨️ **Klavye Kısayolları**: 15+ klavye kısayolu -- 📱 **Touch Gesture'lar**: Mobil cihazlar için özel kontroller - -### 🎨 Gelişmiş Özellikler - -- 📺 **HLS Streaming**: .m3u8 dosyaları için otomatik HLS desteği -- 📝 **Altyazı Desteği**: WebVTT ve SRT formatları -- 🎵 **Çoklu Ses Kanalı**: Farklı dil seçenekleri -- 🎯 **Kalite Seçimi**: HLS stream'lerinde otomatik kalite geçişi -- 🖥️ **Fullscreen**: Native fullscreen API desteği -- 📺 **Picture-in-Picture**: PIP mode desteği -- 🌍 **i18n Desteği**: İngilizce ve Türkçe dil desteği -- 🎨 **Tema Özelleştirme**: CSS değişkenleri ile kolay özelleştirme - -### ⚡ Performans - -- 📦 **Küçük Boyut**: Sadece ~15KB (gzipped) -- 🚀 **Sıfır Runtime Bağımlılık**: React dışında bağımlılık yok -- 🔄 **Lazy Loading**: HLS.js sadece gerektiğinde yüklenir -- 🎯 **Optimize Edilmiş**: Tree-shakeable exports - ---- - -## 📖 API Referansı - -### VideoPlayer Props - -| Prop | Tip | Varsayılan | Açıklama | -|------|-----|------------|----------| -| `src` | `string` | **zorunlu** | Video kaynağı URL (MP4, WebM, HLS) | -| `poster` | `string` | - | Poster/thumbnail resmi URL'si | -| `autoplay` | `boolean` | `false` | Otomatik oynatma | -| `loop` | `boolean` | `false` | Video tekrarı | -| `muted` | `boolean` | `false` | Sessiz başlat | -| `controls` | `boolean` | `true` | Kontrolleri göster | -| `subtitles` | `SubtitleTrack[]` | `[]` | Altyazı track'leri | -| `theme` | `PlayerTheme` | - | Özel tema renkleri | -| `language` | `string` | `'tr'` | Arayüz dili (`'tr'` veya `'en'`) | -| `keyboardShortcuts` | `boolean` | `true` | Klavye kısayollarını etkinleştir | -| `pictureInPicture` | `boolean` | `true` | PIP butonunu göster | -| `className` | `string` | - | Özel CSS class'ı | -| `style` | `CSSProperties` | - | Inline style'lar | -| `onPlay` | `() => void` | - | Oynatma başladığında | -| `onPause` | `() => void` | - | Oynatma durduğunda | -| `onEnded` | `() => void` | - | Video bittiğinde | -| `onTimeUpdate` | `(time: number) => void` | - | Zaman güncellendiğinde | -| `onVolumeChange` | `(volume: number) => void` | - | Ses seviyesi değiştiğinde | -| `onError` | `(error: Error) => void` | - | Hata oluştuğunda | -| `onLoadedMetadata` | `() => void` | - | Metadata yüklendiğinde | -| `onSeeking` | `() => void` | - | Seek başladığında | -| `onSeeked` | `() => void` | - | Seek bittiğinde | - -### SubtitleTrack - -```typescript -interface SubtitleTrack { - src: string // Altyazı dosyası URL'si (.vtt veya .srt) - lang: string // Dil kodu (örn: 'en', 'tr') - label: string // Görüntülenecek etiket - default?: boolean // Varsayılan altyazı olarak ayarla -} -``` - -### AudioTrack - -```typescript -interface AudioTrack { - name: string // Ses track'inin adı - language: string // Dil kodu - url: string // Ses dosyası URL'si - groupId: string // Grup ID'si - default?: boolean // Varsayılan olarak seç -} -``` - -### VideoQuality - -```typescript -interface VideoQuality { - height?: number // Video yüksekliği (px) - label: string // Görüntülenecek etiket (örn: "1080p") - width?: number // Video genişliği (px) - bitrate?: number // Bitrate (bps) - levelIndex?: number // HLS level index -} -``` - -### PlayerTheme - -```typescript -interface PlayerTheme { - primaryColor?: string // Ana renk (varsayılan: #ef4444) - accentColor?: string // Vurgu rengi (varsayılan: #dc2626) - backgroundColor?: string // Arkaplan rengi (varsayılan: #000000) - textColor?: string // Yazı rengi (varsayılan: #ffffff) -} -``` - ---- - -## 💡 Kullanım Örnekleri - -### 1. Basit Video Oynatma - -En temel kullanım: - -```tsx -import { VideoPlayer } from '@alper/video-player' -import '@alper/video-player/styles.css' - -function SimplePlayer() { - return ( - - ) -} -``` - -### 2. Otomatik Oynatma ve Loop - -Video otomatik başlasın ve sürekli tekrarlansın: +### HLS Streaming ile Kullanım ```tsx ``` -### 3. Altyazılı Video - -Çoklu altyazı desteği ile: +### Event Handler'lar ile Kullanım ```tsx console.log('Video oynatılmaya başladı')} + onPause={() => console.log('Video durakladı')} + onEnded={() => console.log('Video bitti')} + onTimeUpdate={(time) => console.log('Geçerli zaman:', time)} + onError={(error) => console.error('Video hatası:', error)} +/> +``` + +### Tema Özelleştirmesi + +```tsx + +``` + +--- + +## 🏗️ Mimari ve Yapı + +### Proje Yapısı + +``` +video-player/ +├── src/ +│ ├── components/ # React UI bileşenleri +│ │ ├── controls/ # Kontrol butonları (Play, Pause, vb.) +│ │ │ ├── PlayPauseButton.tsx +│ │ │ ├── ProgressBar.tsx +│ │ │ ├── VolumeControl.tsx +│ │ │ ├── TimeDisplay.tsx +│ │ │ ├── FullscreenButton.tsx +│ │ │ ├── PIPButton.tsx +│ │ │ ├── SettingsButton.tsx +│ │ │ └── CenterPlayButton.tsx +│ │ ├── menus/ # Ayar menüleri +│ │ │ └── SettingsMenu.tsx +│ │ ├── overlays/ # Overlay bileşenleri +│ │ │ └── LoadingSpinner.tsx +│ │ ├── VideoPlayer.tsx # Ana wrapper bileşen +│ │ ├── VideoElement.tsx # Video element handler +│ │ └── ControlsLayer.tsx # Kontrol katmanı +│ ├── contexts/ # React Context +│ │ └── PlayerContext.tsx +│ ├── hooks/ # Custom React hooks +│ │ ├── useKeyboardShortcuts.ts +│ │ └── useTouchGestures.ts +│ ├── utils/ # Utility fonksiyonlar +│ │ ├── hlsSetup.ts # HLS.js setup +│ │ ├── hlsLoader.ts # HLS.js lazy loading +│ │ ├── hlsControl.ts # HLS kalite/ses kontrolü +│ │ ├── rtmpSetup.ts # FLV.js setup +│ │ ├── rtmpLoader.ts # FLV.js lazy loading +│ │ ├── videoProtocol.ts # Protokol tespiti +│ │ ├── m3u8Parser.ts # M3U8 manifest parsing +│ │ ├── subtitles.ts # SRT/VTT altyazı işleme +│ │ ├── corsHelper.ts # CORS doğrulama +│ │ ├── time.ts # Zaman formatlama +│ │ └── polyfills.ts # Tarayıcı uyumluluk +│ ├── icons/ # SVG icon bileşenleri +│ │ └── index.tsx +│ ├── styles/ # CSS değişkenleri +│ │ └── variables.css +│ ├── i18n/ # Uluslararasılaştırma +│ │ └── index.ts # İngilizce & Türkçe +│ ├── types/ # TypeScript tanımları +│ │ └── index.ts +│ └── index.ts # Ana export dosyası +├── examples/ # Demo uygulaması +│ ├── App.tsx +│ └── main.tsx +├── dist/ # Build çıktısı +├── package.json +├── vite.config.ts # Geliştirme config +├── vite.config.lib.ts # Kütüphane build config +└── tsconfig.json +``` + +### Bileşen Hiyerarşisi + +``` +VideoPlayer (Main) +├── PlayerProvider (Context) +│ ├── VideoElement (Video handler) +│ │ └──