mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-11 01:48:53 -05:00
Add dark background for embed video player
Introduces a utility to set a black background and remove margins/padding for embed contexts in main.jsx, improving visual consistency for embedded video players. Also updates embed.css to enforce a black background for the embed page.
This commit is contained in:
parent
55756e7011
commit
59cba4803b
@ -3,6 +3,30 @@ import { createRoot } from 'react-dom/client';
|
|||||||
|
|
||||||
import VideoJS from './VideoJS.jsx';
|
import VideoJS from './VideoJS.jsx';
|
||||||
|
|
||||||
|
// Function to set dark background for embed contexts
|
||||||
|
const setEmbedBodyBackground = () => {
|
||||||
|
const embedContainer = document.getElementById('video-js-root-embed');
|
||||||
|
const pageEmbed = document.getElementById('page-embed');
|
||||||
|
|
||||||
|
// Check if we're in embed mode
|
||||||
|
if (embedContainer || pageEmbed) {
|
||||||
|
// Store original background to restore later if needed
|
||||||
|
if (!document.body.dataset.originalBackground) {
|
||||||
|
document.body.dataset.originalBackground = document.body.style.backgroundColor || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set dark background for embed
|
||||||
|
document.body.style.backgroundColor = '#000';
|
||||||
|
document.documentElement.style.backgroundColor = '#000';
|
||||||
|
|
||||||
|
// Also set margin and padding to 0 for seamless embed
|
||||||
|
document.body.style.margin = '0';
|
||||||
|
document.body.style.padding = '0';
|
||||||
|
document.documentElement.style.margin = '0';
|
||||||
|
document.documentElement.style.padding = '0';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Mount the components when the DOM is ready
|
// Mount the components when the DOM is ready
|
||||||
const mountComponents = () => {
|
const mountComponents = () => {
|
||||||
// Mount main video player
|
// Mount main video player
|
||||||
@ -25,11 +49,18 @@ const mountComponents = () => {
|
|||||||
<VideoJS videoId="video-embed" />
|
<VideoJS videoId="video-embed" />
|
||||||
</StrictMode>
|
</StrictMode>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Set dark background when embed player is mounted
|
||||||
|
setEmbedBodyBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also check for embed context even without mounting
|
||||||
|
setEmbedBodyBackground();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Expose the mounting function globally for manual triggering
|
// Expose functions globally for manual triggering
|
||||||
window.triggerVideoJSMount = mountComponents;
|
window.triggerVideoJSMount = mountComponents;
|
||||||
|
window.setVideoJSEmbedBackground = setEmbedBodyBackground;
|
||||||
|
|
||||||
// Listen for custom events to trigger mounting
|
// Listen for custom events to trigger mounting
|
||||||
document.addEventListener('triggerVideoJSMount', () => {
|
document.addEventListener('triggerVideoJSMount', () => {
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
/* ===== EMBED PLAYER STYLES ===== */
|
/* ===== EMBED PLAYER STYLES ===== */
|
||||||
/* YouTube-style embed player with fullscreen poster */
|
/* YouTube-style embed player with fullscreen poster */
|
||||||
|
|
||||||
|
/* Black background for embed page to eliminate white space */
|
||||||
|
#page-embed {
|
||||||
|
background-color: #000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fullscreen poster image - fills entire iframe */
|
/* Fullscreen poster image - fills entire iframe */
|
||||||
#page-embed .video-js-root-embed .video-js .vjs-poster {
|
#page-embed .video-js-root-embed .video-js .vjs-poster {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user