mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-08 16:38:54 -05:00
feat: Show overlay (avatar & title) in embed, when controls are visible or video is paused/stopped
This commit is contained in:
parent
d34e8ee5c7
commit
d5d1e2496f
@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>VideoJS</title>
|
||||
</head>
|
||||
<body>
|
||||
<body style="padding: 0; margin: 0">
|
||||
<!-- <div id="video-js-root-main"></div> -->
|
||||
<div id="page-embed">
|
||||
<div id="video-js-root-embed" class="video-js-root-embed"></div>
|
||||
|
||||
@ -184,14 +184,14 @@ class EmbedInfoOverlay extends Component {
|
||||
const player = this.player();
|
||||
const overlay = this.el();
|
||||
|
||||
// Function to show overlay only when video is paused/stopped
|
||||
// Function to show overlay when controls are visible or video is paused/stopped
|
||||
const updateOverlayVisibility = () => {
|
||||
if (player.paused() || player.ended()) {
|
||||
// Show overlay when paused or ended
|
||||
if (player.paused() || player.ended() || player.userActive()) {
|
||||
// Show overlay when paused, ended, or when user is active (controls visible)
|
||||
overlay.style.opacity = '1';
|
||||
overlay.style.visibility = 'visible';
|
||||
} else {
|
||||
// Hide overlay when playing
|
||||
// Hide overlay when playing and user is inactive (controls hidden)
|
||||
overlay.style.opacity = '0';
|
||||
overlay.style.visibility = 'hidden';
|
||||
}
|
||||
@ -202,7 +202,7 @@ class EmbedInfoOverlay extends Component {
|
||||
updateOverlayVisibility();
|
||||
});
|
||||
|
||||
// Hide overlay when video starts playing
|
||||
// Update overlay visibility when video starts/stops playing
|
||||
player.on('play', () => {
|
||||
updateOverlayVisibility();
|
||||
});
|
||||
@ -217,6 +217,15 @@ class EmbedInfoOverlay extends Component {
|
||||
updateOverlayVisibility();
|
||||
});
|
||||
|
||||
// Show/hide overlay based on user activity (controls visibility)
|
||||
player.on('useractive', () => {
|
||||
updateOverlayVisibility();
|
||||
});
|
||||
|
||||
player.on('userinactive', () => {
|
||||
updateOverlayVisibility();
|
||||
});
|
||||
|
||||
// Initial state check
|
||||
setTimeout(() => {
|
||||
updateOverlayVisibility();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user