Custom Html5 Video Player Codepen -
<!-- Progress Bar --> <div class="progress-container"> <div class="progress-bar" id="progressBar"> <div class="progress-filled" id="progressFilled"></div> </div> </div>
/* loading / overlay (optional subtle hint) */ .video-wrapper::after content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; background: radial-gradient(circle at center, transparent 60%, rgba(0,0,0,0.1)); opacity: 0; transition: opacity 0.2s; /* small badge (just for style) */ .player-footer background: rgba(0,0,0,0.3); text-align: center; font-size: 0.7rem; padding: 0.5rem; color: #94a3b8; letter-spacing: 0.3px; border-top: 1px solid rgba(255,255,255,0.05); a color: #7aa2f7; text-decoration: none; </style> <!-- FontAwesome Icons (free CDN) for nice icons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> </head> <body>
.progress-filled width: 0%; height: 100%; background: linear-gradient(90deg, #3b82f6, #60a5fa); border-radius: 12px; position: relative; pointer-events: none;
.ctrl-btn:active transform: scale(0.96); custom html5 video player codepen
/* MAIN PLAYER CARD */ .player-container max-width: 960px; width: 100%; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); border-radius: 2rem; box-shadow: 0 25px 45px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05); overflow: hidden; transition: all 0.2s ease;
.progress-container flex: 1; min-width: 140px; display: flex; align-items: center; gap: 0.6rem;
<!-- Fullscreen button --> <button class="ctrl-btn fullscreen-btn" id="fullscreenBtn" aria-label="Fullscreen"> <i class="fas fa-expand"></i> </button> </div> <div class="player-footer"> 🎬 Custom HTML5 Video Player • Click video to play/pause • Drag progress & volume </div> </div> !-- Progress Bar -->
<!-- Playback speed --> <select id="speedSelect" class="speed-select" aria-label="Playback Speed"> <option value="0.5">0.5x</option> <option value="0.75">0.75x</option> <option value="1" selected>1x</option> <option value="1.25">1.25x</option> <option value="1.5">1.5x</option> <option value="2">2x</option> </select>
/* VIDEO WRAPPER (controls layer) */ .video-wrapper position: relative; width: 100%; background: #000; cursor: pointer;
.progress-bar:hover height: 8px;
/* PROGRESS BAR TRACK */ .progress-bar flex: 1; height: 5px; background: rgba(255, 255, 255, 0.25); border-radius: 12px; cursor: pointer; position: relative; transition: height 0.1s;
video width: 100%; height: auto; display: block; vertical-align: middle;
/* SPEED DROPDOWN */ .speed-select background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.2); color: white; padding: 0.3rem 0.6rem; border-radius: 32px; font-size: 0.8rem; font-weight: 500; cursor: pointer; font-family: inherit; transition: 0.1s; .speed-select:hover background: #1e293b; div class="progress-bar" id="progressBar">
/* PLAY/PAUSE BIG ICON */ .play-pause-btn background: rgba(59, 130, 246, 0.85); color: white; font-weight: bold; .play-pause-btn:hover background: #3b82f6;
<script> (function() { // DOM elements const video = document.getElementById('videoPlayer'); const playPauseBtn = document.getElementById('playPauseBtn'); const playIcon = playPauseBtn.querySelector('i'); const timeDisplay = document.getElementById('timeDisplay'); const progressBar = document.getElementById('progressBar'); const progressFilled = document.getElementById('progressFilled'); const muteBtn = document.getElementById('muteBtn'); const volumeSlider = document.getElementById('volumeSlider'); const speedSelect = document.getElementById('speedSelect'); const fullscreenBtn = document.getElementById('fullscreenBtn'); const videoWrapper = document.getElementById('videoWrapper');