UNPKG

react-advanced-video-player

Version:

React Advanced Video Player is a customizable and feature-rich video player for React applications. It supports multiple video formats, subtitles, quality selection, Picture-in-Picture mode, playback speed adjustment, and more, providing a seamless media

490 lines (427 loc) 8.92 kB
:root { --primary-color: #3b82f6; --text-light: #ffffff; --text-dark: #1f2937; --bg-dark: #111827; --bg-light: #ffffff; --overlay-dark: rgba(0, 0, 0, 0.5); --progress-bar-color: #3b82f6; --button-color: #3b82f6; } /* 🎨 Dark Theme */ .theme-dark { --primary-color: #1e40af; --text-color: #ffffff; --bg-color: #111827; --control-bg: rgba(255, 255, 255, 0.1); --progress-bar-color: #1e3a8a; --button-color: #1e3a8a; } /* 🎨 Light Theme */ .theme-light { --primary-color: #2563eb; --text-color: #1f2937; --bg-color: #f9fafb; --control-bg: rgba(0, 0, 0, 0.1); --progress-bar-color: #2563eb; --button-color: #2563eb; } /* 🎨 Minimal Theme */ .theme-minimal { --primary-color: #64748b; --text-color: #333; --bg-color: #f5f5f5; --control-bg: rgba(50, 50, 50, 0.1); --progress-bar-color: #64748b; --button-color: #64748b; } /* 🎨 Ocean Theme */ .theme-ocean { --primary-color: #0ea5e9; --text-color: #f0f9ff; --bg-color: #0369a1; --control-bg: rgba(255, 255, 255, 0.2); --progress-bar-color: #0ea5e9; --button-color: #0ea5e9; } /* 🎨 Neon Theme */ .theme-neon { --primary-color: #facc15; --text-color: #ffffff; --bg-color: #0f172a; --control-bg: rgba(255, 255, 255, 0.3); --progress-bar-color: #facc15; --button-color: #facc15; } /* 🎨 Custom Theme */ .theme-custom { --primary-color: #ff5733; --text-color: #ffffff; --bg-color: #2c2c2c; --control-bg: rgba(255, 255, 255, 0.1); --progress-bar-color: #ff5733; --button-color: #ff5733; } /* Reset and base styles */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: system-ui, -apple-system, sans-serif; } /* Main container styles */ .min-h-screen { min-height: 100vh; } .bg-gray-900 { background-color: var(--bg-dark); } .flex { display: flex; } .items-center { align-items: center; } .justify-center { justify-content: center; } .p-4 { padding: 1rem; } .w-full { width: 100%; } .max-w-4xl { max-width: 56rem; } /* Video Player Container */ .video-container { position: relative; width: 100%; background: var(--bg-color); color: var(--text-color); border-radius: 0.5rem; overflow: hidden; aspect-ratio: 16 / 9; } .video-player { width: 100%; height: 100%; object-fit: cover; } .setting-controls-wrapper { position: absolute; width: -webkit-fill-available; display: flex; justify-content: end; align-items: center; top: 0; right: 0; padding: 0.5rem; background: linear-gradient(rgba(0, 0, 0, 0.9), transparent); transition: opacity 0.3s ease; -webkit-transition: opacity 0.3s ease; -moz-transition: opacity 0.3s ease; -ms-transition: opacity 0.3s ease; -o-transition: opacity 0.3s ease; } /* Controls */ .controls-wrapper { position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem; background: linear-gradient(transparent, rgba(0, 0, 0, 0.9)); transition: opacity 0.3s ease; } .progress-container { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; } /* Container for the progress bar and time displays */ .progress-container { display: flex; align-items: center; gap: 10px; /* Space between elements */ width: 100%; /* Full width */ } /* Style for the time displays */ .time-display { font-size: 14px; color: var(--text-light); /* White text */ } /* Style the range input (progress bar) */ .progress-bar { flex: 1; /* Take up remaining space */ height: 3px; /* Default height */ background: rgba(255, 255, 255, 0.3); /* Background color of the track */ cursor: pointer; /* Pointer cursor on hover */ outline: none; /* Remove outline */ border-radius: 16px; /* Rounded corners */ transition: height 0.3s ease-in-out; /* Smooth height transition */ } /* Hover effect for the progress bar */ .progress-bar:hover { height: 5px; } /* Style the thumb (slider handle) */ .progress-bar::-webkit-slider-thumb { -webkit-appearance: none; height: 15px; width: 15px; background-color: var(--progress-bar-color); border: 2px solid white; border-radius: 50%; cursor: pointer; transition: transform 0.2s ease-in-out; } /* Hover effect for the thumb */ .progress-bar:hover::-webkit-slider-thumb { transform: scale(1.2); } /* Style for Mozilla Firefox */ .progress-bar::-moz-range-thumb { height: 15px; width: 15px; background-color: var(--progress-bar-color); border: 2px solid white; border-radius: 50%; cursor: pointer; } /* Hover effect for the thumb in Firefox */ .progress-bar:hover::-moz-range-thumb { transform: scale(1.2); -webkit-transform: scale(1.2); -moz-transform: scale(1.2); -ms-transform: scale(1.2); -o-transform: scale(1.2); } /* Style the track in Firefox */ .progress-bar::-moz-range-track { width: 100%; /* Full width */ height: 4px; /* Default height */ background: var(--progress-bar-color); /* Background color of the track */ border-radius: 16px; /* Rounded corners */ transition: height 0.3s ease-in-out; /* Smooth height transition */ } /* Hover effect for the track in Firefox */ .progress-bar:hover::-moz-range-track { height: 5px; } .time-display { color: var(--text-light); font-size: 0.875rem; min-width: 4rem; opacity: 0.9; } .end-time { display: flex; justify-content: end; } .controls-bar { display: flex; justify-content: space-between; align-items: center; } .controls-left, .controls-center, .controls-right { display: flex; align-items: center; gap: 0.75rem; } .control-button { background: none; border: none; color: var(--text-light); cursor: pointer; padding: 0.5rem; transition: all 0.2s ease; opacity: 0.9; border-radius: 0.25rem; } .control-button:hover { opacity: 1; background-color: var(--primary-color); } /* Volume Control */ .volume-control { display: flex; align-items: center; gap: 0.5rem; } .volume-slider { width: 0; height: 4px; background: rgba(255, 255, 255, 0.3); border-radius: 2px; cursor: pointer; transition: width 0.2s ease; opacity: 0; } .volume-control:hover .volume-slider { width: 80px; opacity: 1; } .volume-slider::-webkit-slider-thumb { /* -webkit-appearance: none; */ width: 12px; height: 12px; background-color: var(--progress-bar-color); border-radius: 50%; cursor: pointer; } /* Settings Panel */ .settings-panel { position: absolute; top: 46px; right: 7px; background: rgba(28, 28, 28, 0.9); border-radius: 0.5rem; min-width: 200px; backdrop-filter: blur(8px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); } .settings-menu { display: flex; flex-direction: column; overflow-y: auto; max-height: 350px; gap: 0.25rem; padding: 0.5rem; } .settings-menu::-webkit-scrollbar { width: 0px; } .settings-button { display: flex; justify-content: space-between; align-items: center; background: none; border: none; color: var(--text-light); padding: 0.75rem; width: 100%; cursor: pointer; transition: background-color 0.2s ease; border-radius: 0.25rem; } .settings-button:hover { background-color: var(--primary-color); } .settings-dropdown { border-radius: 0.25rem; padding: 0.5rem; padding-top: 0; padding-left: 20px; } .dropdown-item { display: block; width: 100%; padding: 0.75rem; background: none; border: none; color: var(--text-light); cursor: pointer; text-align: left; transition: background-color 0.2s ease; border-radius: 0.25rem; opacity: 0.9; } .dropdown-item:hover { background-color: var(--primary-color); opacity: 1; } .dropdown-item.active { background-color: var(--primary-color); color: var(--text-light); } /* Play/Pause Overlay */ .play-pause-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: transparent; cursor: pointer; } .play-pause-button { background: none; border: none; color: var(--text-light); opacity: 0; transition: opacity 0.2s ease; padding: 1rem; border-radius: 50%; background-color: rgba(0, 0, 0, 0.5); } .play-pause-overlay:hover .play-pause-button { opacity: 1; } .unlock { position: absolute; top: 1rem; right: 1rem; background-color: black; opacity: 40%; } /* Responsive Design */ @media (max-width: 640px) { .controls-wrapper { padding: 0.75rem; } .volume-control { display: none; } .controls-right { gap: 0.25rem; } .time-display { font-size: 0.75rem; min-width: 3rem; } .settings-panel { bottom: 60px; right: 5px; min-width: 180px; } .settings-button, .dropdown-item { padding: 0.5rem; } } @media (max-width: 480px) { .controls-center { gap: 0.25rem; } .control-button { padding: 0.25rem; } .progress-container { gap: 0.5rem; } }