learnix / src /app /about /styles /AutoPlayVideo.css
shashidharak99's picture
Upload files
7d51e81 verified
Raw
History Blame Contribute Delete
3.3 kB
/* VIDEO CONTAINER: CENTER HORIZONTALLY */
.video-container {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
padding: 20px 0;
position: relative;
min-height: calc(500px * 0.5625);
}
/* VIDEO LOADER */
.video-loader {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: 500px;
height: calc(500px * 0.5625);
background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
border-radius: 12px;
}
.video-spinner {
width: 40px;
height: 40px;
border: 3px solid #e5e7eb;
border-top: 3px solid #3b82f6;
border-radius: 50%;
animation: video-spin 1s linear infinite;
}
@keyframes video-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* VIDEO HIDDEN WHILE LOADING */
.auto-video.video-hidden {
opacity: 0;
position: absolute;
}
/* VIDEO ITSELF (16:9) */
.auto-video {
width: 500px;
height: calc(500px * 0.5625); /* 16:9 */
object-fit: cover;
border-radius: 12px;
pointer-events: none;
user-select: none;
-webkit-user-drag: none;
-moz-user-select: none;
-ms-user-select: none;
transition: opacity 0.3s ease;
}
/* RESPONSIVE: MOBILE */
@media (max-width: 500px) {
.video-container {
min-height: calc(95vw * 0.5625);
}
.video-loader {
width: 95%;
height: calc(95vw * 0.5625);
}
.auto-video {
width: 95%;
height: calc(95vw * 0.5625); /* maintain 16:9 */
}
}
/* NO DRAG OR SELECT */
.auto-video,
video {
pointer-events: none;
user-select: none;
}
/* ----------------------------------
RESPONSIVE VIDEO PLAYER + SOUND BTN
---------------------------------- */
/* MAIN CONTAINER: Centers video */
.video-container {
display: flex;
justify-content: center;
width: 100%;
padding: 20px 0;
position: relative;
}
/* VIDEO LOADER */
.video-loader {
position: absolute;
width: 500px;
height: calc(500px * 0.5625); /* 16:9 ratio */
background: #f5f5f5;
border-radius: 12px;
display: flex;
justify-content: center;
align-items: center;
}
.video-spinner {
width: 36px;
height: 36px;
border: 4px solid #ddd;
border-top: 4px solid #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* HIDE VIDEO WHILE LOADING */
.auto-video.video-hidden {
opacity: 0;
position: absolute;
}
/* VIDEO STYLES (16:9) */
.auto-video {
width: 500px;
height: calc(500px * 0.5625); /* 16:9 */
object-fit: cover;
border-radius: 12px;
transition: opacity 0.3s ease;
pointer-events: none;
user-select: none;
}
/* SOUND BUTTON (Bottom-Right, Inside Video) */
.sound-btn {
position: absolute;
bottom: 10px;
right: 12px;
background: rgba(0, 0, 0, 0.4);
padding: 6px;
border-radius: 50%;
cursor: pointer;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
transition: background 0.2s ease;
}
.sound-btn:hover {
background: rgba(0, 0, 0, 0.6);
}
.sound-icon {
color: #ffffff; /* Always white */
font-size: 1.2rem;
}
/* MOBILE / SMALL SCREENS */
@media (max-width: 500px) {
.auto-video,
.video-loader {
width: 95%;
height: calc(95vw * 0.5625); /* 16:9 ratio */
}
.sound-btn {
right: 8px;
bottom: 8px;
}
}